SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By mooreadam
#182124
Hey people,

I have been attempting to get a muscle sensor kit from sparkfun working(https://www.sparkfun.com/products/13027). However after hooking everything up and running the code provided on the website it seems to return random noise in the serial monitor - the values varying from 200 to 500, whether the muscles sensor are connected or not. It seems the code provided on the website doesn't actually correlate with the suggested setup.

I was wondering if anyone else has had similar experiences or if anyone could suggest a way to write a code that would allow me to read the sensors inputs in the serial monitor?

Here is my setup:
Image

This is the code on the muscle sensor page:
Code: Select all
// reads analog input from the five inputs from your arduino board 
// and sends it out via serial

// variables for input pins and
int analogInput[6];
  
// variable to store the value 
int value[6]; 
 
void setup()
{
  // declaration of pin modes
  for(int i=0;i<6;i++)
  {
    analogInput[i] = i+1;
    value[i] = 0;     
    pinMode(analogInput[i], INPUT);    
  }
  
  // begin sending over serial port
  Serial.begin(9600);
}

void loop()
{
  // read the value on analog input
  for(int i=0;i<6;i++)
  {
    value[i] = analogRead(analogInput[i]);
  }

  // print out value over the serial port
  for(int i=0;i<6;i++)
  {
    Serial.println(10000 + i + 1); //prefix
    Serial.println(value[i]);
    Serial.println(10010); //end signal
  }
  // wait for a bit to not overload the port
  delay(10);
}




Cheers,

Adam.
By priyesh.shah_147
#183578
I have a problem, the v3 sensor gives a reading of 0, even when contraction of the muscle. I used arduino analog read codes.

The code

int analogPin = A0; // potentiometer wiper (middle terminal) connected to analog pin 3

// outside leads to ground and +5V

int val = 0; // variable to store the value read



void setup()

{

Serial.begin(9600); // setup serial

}



void loop()

{

val = analogRead(analogPin); // read the input pin

Serial.println(val); // debug value

}