Tuesday, April 12, 2011

Wiring Variable Resistors

Here is a nice little wiring diagram/refresher about getting good reads into the arduino from a variable resistor (photocell, pressure sensor, bend sensor, etc). The below link is specifically about Pressure sensors (shown above and to be demoed in class on Wednesday the 13th of April), but the same can apply to any variable resistor sensor. Note that in the case of the Pressure sensor, the small resistor is a 10k.

Link: http://www.ladyada.net/learn/sensors/fsr.html

The code to see how well it's working:
//*****************************************************
int pressure = 0;
void setup(){
 Serial.begin(9600); 
}

void loop(){
  pressure = analogRead(0);
  Serial.println(pressure);
  //analogWrite(3, pressure/4); // Use this to light up an LED based on the pressure (wired to pin 3)
}
//*****************************************************

No comments:

Post a Comment