Control what you want by connecting a super simple website that uses the Web Speech API to send serial messages to your Arduino! No need for ESP32!
Devices and components
Arduino Uno Rev3
Software and tools
Banana Bacon
Project description
What is this?
APIs involved:
Web Serial API
Web Voice API
By the way, it’s on GitHub!
I hope you have fun with this! Now go do something cool!
Arduino code example for SMD RGB
1/* Remember to connect your Arduino to a computer that's running the website!
2Don't forget to click the connect button on the website.
3Allow microphone and say either "Red", "Blue", or "Green" into the computer's microphone. The light should change colour.
4When saving this code, please put it as .ino to ensure Arduino IDE understands it.*/
5
6const int redPin = 11;
7const int greenPin = 10;
8const int bluePin = 9;
9
10void setup() {
11 Serial.begin(9600);
12}
13
14void loop() {
15 String input = "";
16 if (Serial.available()) {
17 input = Serial.readStringUntil('\n'); // Read until newline
18 input.trim(); // Remove any spaces or newline characters
19 input.toLowerCase();
20 }
21
22if (input == "red") {
23 analogWrite(redPin, 255);
24 analogWrite(greenPin, 0);
25 analogWrite(bluePin, 0);
26 }
27
28 if (input == "green") {
29 analogWrite(redPin, 0);
30 analogWrite(greenPin, 255);
31 analogWrite(bluePin, 0);
32 }
33
34 if (input == "blue") {
35 analogWrite(redPin, 0);
36 analogWrite(greenPin, 0);
37 analogWrite(bluePin, 255);
38 }
39
40 if (input == "crab") {
41 playMelody(crabRaveMelody, crabRaveDurations, sizeof(crabRaveMelody)/sizeof(int));
42 }
43
44}
Note: Content and images are from: https://projecthub.arduino.cc/, with some modifications.
If you want it removed due to copyright reasons, please leave a comment. Thank you.
I want to share this article more widely so that everyone knows about Arduino and your project.