Transmissive optical sensor without aperture Vishay TCST1000/TCST2000
by Diana Fernandez

Demonstrates how to use a transmisive optical sensor. This sensor is used in mechanisms to detect when the gap in the top is blocked by an object. When the sensor detects an interruption the Wiring onboard LED is turned on.

Created 7 May 2007
 

   
// 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 
}