| |
|
|
|
|
|
I tested IR sensors for Physical Computer project. I used Infrared LED(Radioshack 276-143), Infrared Phototransistor(Radioshack 276-145). For basic circuit, I saw this reference.


It works fine!
#define detectorPin0 0
#define detectorPin1 1
#define detectorPin2 2
int detectorValue0 = 0;
int detectorValue1 = 0;
int detectorValue2 = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
detectorValue0 = analogRead(detectorPin0) / 4;
detectorValue1 = analogRead(detectorPin1) / 4;
detectorValue2 = analogRead(detectorPin2) / 4;
Serial.print(255-detectorValue0);
Serial.print("\t");
Serial.print(255-detectorValue1);
Serial.print("\t");
Serial.print(255-detectorValue2);
Serial.print("\t");
Serial.println();
delay(5);
} |
|
|
| Track this back : http://itp.nyu.edu/~yc581/blog/trackback/20 |
|
|
|
|
Total : 154566
Today : 0
Yesterday : 0 |
|
|
|