Skip to content

Instantly share code, notes, and snippets.

@Ajak58a
Created January 5, 2024 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ajak58a/81ad0d7f3801f87ab3253bf35990a344 to your computer and use it in GitHub Desktop.
Save Ajak58a/81ad0d7f3801f87ab3253bf35990a344 to your computer and use it in GitHub Desktop.
Sign Language To Speech Converter
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"
// Use pins 2 and 3 to communicate with DFPlayer Mini
static const uint8_t PIN_MP3_TX = 26; // Connects to module's RX
static const uint8_t PIN_MP3_RX = 27; // Connects to module's TX
SoftwareSerial softwareSerial(PIN_MP3_RX, PIN_MP3_TX);
// Create the Player object
DFRobotDFPlayerMini player;
const int Analog1 = 36;
int V1 = 0;
void setup()
{
// Init USB serial port for debugging
Serial.begin(9600);
// Init serial port for DFPlayer Mini
softwareSerial.begin(9600);
// Start communication with DFPlayer Mini
if (player.begin(softwareSerial)) {
Serial.println("OK");
// Set volume to maximum (0 to 30).
player.volume(20);
} else {
Serial.println("Connecting to DFPlayer Mini failed!");
}
}
void loop(){
v1 = analogRead(Analog1);
Serial.println(v1);
if (v1 > 1400)
{
Serial.println("Please Give Me Water");
player.play(1);
delay(1000);
}
else if ((v1 < 1400) && (v1 > 800))
{
Serial.println("Please Give Me Food");
player.play(2);
delay(1000);
}
else if((v1 < 800) && (v2 > 450))
{
Serial.println("Give Me Medicine");
player.play(3);
delay(1000);
}
else{
}
delay(50);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment