Hi,
I need help writing a code in Arduino:
I have one EMG sensor and five servo motors. How can I write the code that when the EMG sensor value is lower than (or higher than) a Value, then the servo motors move?
(I don't want to map the EMG value to the Servo motors)
this is what I come up with:
void loop() { //Main code, run repeatedly:
emgValue = analogRead(emgPin); // Read EMG sensor Value
Serial.printIn(emgValue); // Print EMG Sensor Value t serial monitor
//Game
when(emgValue >> 300){
if(Serial.available()>0) {
p=Serial.read();
if(p=='1') {
rock();
}
else if(p=='2') {
paper();
}
else if(p=='3') {
scissor();
}
}
}
}