Created
April 14, 2013 02:53
-
-
Save dz1984/5381202 to your computer and use it in GitHub Desktop.
把Arduino抓到的數值,透過Serial方式傳到Processing程式,利用Processing的互動特性,將這些數值視覺化,方便觀察數字變化關係。 (Arduino)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//A0 - input pin | |
int fsrPin = 0; | |
byte fsrReading; | |
void setup(){ | |
pinMode(fsrPin,INPUT); | |
Serial.begin(9600); | |
} | |
void loop(){ | |
//Translate 0~1023 to 0~254 | |
fsrReading = map(analogRead(fsrPin),0,1023,0,254); | |
//Write a byte to PC through Serial port. | |
Serial.write(fsrReading); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment