Hi all,
To start, I am very knew to Arduino. I am using two EMG sensors connected to my Arduino. I would like to add the elapsed time next to each output value, starting from time=0. I included an image of my serial monitor. Next to each data point, I would like to have the elapsed time. I am unsure how to do this and would like some suggestions with code on how to accomplish this.
int onboardLED = 13; // Arduino onboard LED (pin 13) you can control
int voltageThreshold = 400; // any reading higher will trigger an action
void setup() {
// put your setup code here, to run when Arduino is powered on:
Serial.begin(1200);
pinMode(onboardLED, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int currentVoltage = analogRead(A0); // store the incoming voltage
Serial.print(currentVoltage); // prints voltage to monitor
if(currentVoltage > voltageThreshold){
// trigger actions
Serial.println(" Left CONTRACTION"); // prints string + new line
digitalWrite(onboardLED, HIGH); //this sends 5V, turning on LED
} else {
Serial.println(""); //adds a new line
digitalWrite(onboardLED, LOW);
// turn off the light as threshold is not met
}
// put your main code here, to run repeatedly:
int currentVoltage2 = analogRead(A1); // store the incoming voltage
Serial.print(currentVoltage2); // prints voltage to monitor
if(currentVoltage2 > voltageThreshold){
// trigger actions
Serial.println(" Right CONTRACTION!"); // prints string + new line
digitalWrite(onboardLED, HIGH); //this sends 5V, turning on LED
} else {
Serial.println(""); //adds a new line
digitalWrite(onboardLED, LOW);
// turn off the light as threshold is not met
}
}