Is the new Raspberry Pi AI Kit better than Google Coral?
138495 Views
Build Your Own AI Assistant Part 1 - Creating the Assistant
122239 Views
Control Arduino with Python using Firmata / PyFirmata
89178 Views
How to Map with LiDAR - using a Raspberry Pi Zero 2W, RPLidar and Rviz
66846 Views
Creating a Supercomputer with a Raspberry Pi 5 Cluster and Docker Swarm!
61817 Views
Node-Red Automation, MQTT, NodeMCU & MicroPython
54241 Views
Creating Gears in Fusion 360
UGREEN DXP 4800 Plus NAS Review
How Serial Servos Work (and Why They’re Awesome for Robotics)
How to Keep your Raspberry Pi happy
How to Install Pi-Apps on a Raspberry Pi
Pikon II, The Ultimate DIY Raspberry Pi Camera!
DuckDB - Fast, free analytics
1h 36m
Obsidian
1h 0m
Getting Started with C on the Raspberry Pi Pico
0h 50m
Running K3s on Raspberry Pi
1h 28m
From Docker to Podman
1h 2m
MicroPython Robotics Projects with the Raspberry Pi Pico
0h 54m
Learn how to Program in Python, C, Rust, and more.
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 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 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 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 >
You can use the arrows ← → on your keyboard to navigate between lessons.
← →