This is my first time using Arduino and it's for a school assignment so I have no idea what i'm doing but i'm trying to use my sensors to show muscle contractions and when I go to the serial plotter while the sensor is attached it's just a linear line. This is the code I was told to use:
//This is the script to collect data on muscle contractions using the Myoware sensor.
const int analogInPin = A0; // Analog input pin that the muscle sensor is attached to
int sensorValue = 0; // Variable to store the value coming from the sensor
int outputValue = 0; // Variable to store the adjusted sensorValue
void setup() {
// initialize serial communications at 9600 bits per second:
Serial.begin(9600);
}
// The loop routine runs over and over again until you remove power
void loop() {
sensorValue = analogRead(analogInPin); // Redefines sensorValue variable based on current measurement
outputValue = map(sensorValue, 0, 1023, 0, 255);
unsigned long currentTime = millis(); // Defines variable based on how long the sketch has been running (in milliseconds)
Serial.print(currentTime);
Serial.print("\t");
Serial.println(outputValue);
delay(1000);
}
Any help or advice would be greatly appreciated. Thank you!