|
// Transmissive optical sensor without aperture Vishay TCST1000/TCST2000
// by Diana Fernandez
int sensorSwitch = 1; // digital pin to attach the switch
int sensorLED = 0; // Wiring onboard LED
int boardLED = 48;
void setup()
{
pinMode(sensorSwitch, INPUT); // sets digital pin 1 as input
pinMode(sensorLED, OUTPUT); // sets digital pin 0 as output
pinMode(boardLED, OUTPUT); // sets digital pin 48 as output
digitalWrite(sensorLED, HIGH); // turns ON the sensor LED
}
void loop()
{
digitalWrite(boardLED, digitalRead(sensorSwitch)); // make the onboard LED to show the sensor status
}
|