1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-21 15:54:39 +01:00

Fixed SerialCallResponseASCII example so sensor output matches what Processing sketch expects.

This commit is contained in:
Tom Igoe 2011-10-26 13:23:04 -04:00
parent d16eeb0af3
commit 432fab12db

View File

@ -19,7 +19,7 @@
Created 26 Sept. 2005 Created 26 Sept. 2005
by Tom Igoe by Tom Igoe
modified 30 Aug 2011 modified 26 Oct 2011
by Tom Igoe and Scott Fitzgerald by Tom Igoe and Scott Fitzgerald
This example code is in the public domain. This example code is in the public domain.
@ -47,12 +47,10 @@ void loop()
if (Serial.available() > 0) { if (Serial.available() > 0) {
// get incoming byte: // get incoming byte:
inByte = Serial.read(); inByte = Serial.read();
// read first analog input, divide by 4 to make the range 0-255: // read first analog input:
firstSensor = analogRead(A0)/4; firstSensor = analogRead(A0);
// delay 10ms to let the ADC recover: // read second analog input:
delay(10); secondSensor = analogRead(A1);
// read second analog input, divide by 4 to make the range 0-255:
secondSensor = analogRead(A1)/4;
// read switch, map it to 0 or 255L // read switch, map it to 0 or 255L
thirdSensor = map(digitalRead(2), 0, 1, 0, 255); thirdSensor = map(digitalRead(2), 0, 1, 0, 255);
// send sensor values: // send sensor values: