Build Your Own AI Assistant Part 1 - Creating the Assistant
116820 Views
Is the new Raspberry Pi AI Kit better than Google Coral?
114678 Views
Control Arduino with Python using Firmata / PyFirmata
87081 Views
How to Map with LiDAR - using a Raspberry Pi Zero 2W, RPLidar and Rviz
57314 Views
Creating a Supercomputer with a Raspberry Pi 5 Cluster and Docker Swarm!
53588 Views
Node-Red Automation, MQTT, NodeMCU & MicroPython
52067 Views
SMARS Lab upgrade with PyCharm
Chicken Nugget Piano
Pi Tray - Mini-rack - Part II
Weather Station Display
Pi 10 Inch Mini-rack
Installing and Using DeepSeek-R1:1.5 on a Raspberry Pi with Docker
Mini-Rack 3D Design Tutorial
0h 20m
Using the Raspberry Pi Pico's Built-in Temperature Sensor
0h 24m
Getting Started with SQL
0h 32m
Introduction to the Linux Command Line on Raspberry Pi OS
0h 42m
How to install MicroPython
0h 8m
Wall Drawing Robot Tutorial
0h 22m
Learn Linux from the basics to advanced topics.
Learn how to use a Raspberry Pi Pico
Learn MicroPython the best language for MicroControllers
Learn Docker, the leading containerization platform. Docker is used to build, ship, and run applications in a consistent and reliable manner, making it a popular choice for DevOps and cloud-native development.
Learn how to build SMARS robots, starting with the 3D Printing the model, Designing SMARS and Programming SMARS
Learn how to build robots, starting with the basics, then move on to learning Python and MicroPython for microcontrollers, finally learn how to make things with Fusion 360.
Learn Python, the most popular programming language in the world. Python is used in many different areas, including Web Development, Data Science, Machine Learning, Robotics and more.
Learn how to create robots in 3D, using Fusion 360 and FreeCAD. The models can be printed out using a 3d printer and then assembled into a physical robot.
Learn how to create Databases in Python, with SQLite3 and Redis.
KevsRobots Learning Platform
70% Percent Complete
By Kevin McAleer, 3 Minutes
In this lesson you will learn how to connect a HC-08 (or HC-09 / HC-10) bluetooth module to your Arduino and then use that to pair to an iOS or Android phone. We will then modify the code written in previous lessons to remotely control our SMARS.
Before you begin, you’ll need to make sure you have a couple of things before you start this lesson:
New Sketch
You can download the code below from GitHub, but its better to type it in yourself line by line, as you will get to understand what each line means.
Make sure to download the pitches.h and melody.h, from the github link above, to the same folder where you create the code below.
pitches.h
melody.h
#include <Dabble.h> #include <SoftwareSerial.h> #include "pitches.h" #define CUSTOM_SETTINGS #define INCLUDE_GAMEPAD_MODULE // set Motor A to Arduino Pins int motor_A = 12; // official Arduino Motor Shield uses D12 int motor_B = 13; // official Arduino Motor Shield uses D13 int buzzer = 4; // set the Motor Speed using the Arduino Pins int motor_A_speed = 10; // official Arduino Motor Shield uses D3 int motor_B_speed = 11; // official Arduino Motor Shield uses D11 // set the time between motor on and motor off int wait_in_milliseconds = 100; void setup() { // put your setup code here, to run once: Dabble.begin(9600); Serial.begin(9600); // set the Arduino pin to OUTPUT mode pinMode(motor_A, OUTPUT); pinMode(motor_B, OUTPUT); pinMode(buzzer, OUTPUT); } // notes in the melody: int melody[] = { F3, D3, AS2, AS2, AS2, C3, D3, DS3, F3, F3, F3 ,D3 }; int noteDurations[] = { 8, 8, 4, 4, 8, 8, 8, 8, 4, 4, 4, 8 }; struct Note { int key; int duraiton; }; void playMelody() { for (int thisNote = 0; thisNote < 12 ; thisNote++) { // to calculate the note duration, take one second divided by the note type. //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc. int noteDuration = 1000 / noteDurations[thisNote]; tone(4, melody[thisNote], noteDuration); // to distinguish the notes, set a minimum time between them. // the note's duration + 30% seems to work well: int pauseBetweenNotes = noteDuration * 1.30; delay(pauseBetweenNotes); // stop the tone playing: noTone(8); } } void loop() { // put your main code here, to run repeatedly: Dabble.processInput(); if (GamePad.isUpPressed()) forward(); if (GamePad.isDownPressed()) backward(); if (GamePad.isLeftPressed()) turnLeft(); if (GamePad.isRightPressed()) turnRight(); if (GamePad.isTrianglePressed()) beep(); if (GamePad.isSquarePressed()) playMelody(); }
< Previous Next >