[line-3, body-2]
+ Started</br> 29th Nov 2024
+ Problem Statement
+ I have told to make a smart watch for ladies protection , which sends a sos message containing the current locatio to the parrent and the police in the following senarios
- A button is pressed
- Heart rate is unusual that normal and "HELP" command is detected
**Requirements**
- Heart Beat -> to Sense
- SOS Switch
- Voice Detection
+ First Meating</br> 30th Nov 02-12-2024
+ Initial requirements
+ - It should have a sos button and when that is pressed
> it the microcontroller will send the watches location to police and parents
- To facilitate failsafe , the watch also senses heart rate and if the heart rate is above some threshold it will also send location to parents and the police
- Continuesly monitor for the command **HELP!** if help is found do the sos thing
#include <SoftwareSerial.h>
SoftwareSerial vc02Serial(10, 11); // RX, TX
void setup() {
Serial.begin(9600);
vc02Serial.begin(9600);
Serial.println("VC-02 Voice Recognition Module Initialized"); }
void loop() {
if (vc02Serial.available()) {
String command = vc02Serial.readStringUntil('\n');
Serial.print("Received Command: ");
Serial.println(command);
if (command == "TURN ON LIGHT") {
Serial.println("Turning on the light...");
} else if (command == "TURN OFF LIGHT") {
Serial.println("Turning off the light...");
}
else {
Serial.println("Unknown command");
}
}
}
Explained Code
#include <SoftwareSerial.h>
// Define the pins for SoftwareSerial
SoftwareSerial vc02Serial(10, 11);
// RX, TX
void setup() {
// Start the hardware serial communication Serial.begin(9600);
// Start the software serial communication vc02Serial.begin(9600);
Serial.println("VC-02 Voice Recognition Module Initialized"); }
void loop() {
// Check if data is available from the VC-02 module
if (vc02Serial.available()) {
// Read the incoming data
String command = vc02Serial.readStringUntil('\n');
Serial.print("Received Command: ");
Serial.println(command);
// Process the command
if (command == "TURN ON LIGHT") { Serial.println("Turning on the light...");
// Add code to turn on the light
} else if (command == "TURN OFF LIGHT") { Serial.println("Turning off the light..."); // Add code to turn off the light }
else { Serial.println("Unknown command"); } } }