EMG Sensor and Arduino Coding

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();
    }
  }
}
}
if (EMGsensorvalue < value) servo.write(lowerValue); 
if (EMGsensorvalue > value) servo.write(higherValue); 

You can begin to write code for the Arduino when you know and have written what you want to happen in your code. You have not said what the servos are to do when you want them to move. Do you have a program that moves the servos as you want? Get that going first, then add code for the EMG sensor.
You have not mentioned how you are powering the servos. That would be a great first step!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.