Tiny Adjustable Infrared Sensor Switch
Introduction¶
This is a new version of infrared distance switch. It has small size and higher ranging, it is able to detect ranging from 3cm to 100cm. It is tiny, easy to use/assemble, and inexpensive. Useful for robotics, interactive media, industrial assembly line, etc.
Model: SOD00300S
Features¶
- Power supply: 5V
- Current: 100mA
- Range: 3-100cm adjustable
Usage¶
Hardware¶
Connect this sensor to your Arduino/Crowduino digital pins( D2 for example). When there is an object behind this sensor, the output would be low.
Programming¶
1.Copy the following program to Arduino IDE and upload to your Arduino/Crowduino:
void setup() {
Serial.begin(9600);
pinMode(2,INPUT);
}
void loop() {
while(1) {
delay(500);
if(digitalRead(2)==LOW) {
Serial.println("object detected.");
}
else {
Serial.println("no object detected.");
}
}
}
2.Open the Serial moniter, and set the baudrate to 9600, you will see the output change with the object behind this sensor or not.