1 2 3 4 5 6 7 8
Arduino arduino; FSR-400 sensor; R10kΩ R1; sensor- = arduino.Gnd; sensor+ = arduino.A1 sensor+ = R1-; R1+ = arduino.Gnd;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
const int iSensor = 1; void fSendInt1024(int a); void setup() { Serial.begin(9600); } void loop() { int vSensor = 0; // in int[0:.1024] vSensor = analogRead(iSensor); fSendInt1024(vSensor); delay(500); } void fSendInt1024(int a) { char vData[6]; vData[3] = '0' + a % 10; a /= 10; vData[2] = '0' + a % 10; a /= 10; vData[1] = '0' + a % 10; a /= 10; vData[0] = '0' + a % 10; vData[4] = '\n'; vData[5] = '\0'; Serial.write(vData); }