In this example I will quickly show you how you could achieve such a feat using a phototransistor and the sender/receiver system I mentioned in my second post.
Here goes;
int sensorPin = A0;
int sensorValue = 0;
void setup(){
Serial.begin(9600);
}
void loop(){
sensorValue = analogRead(sensorPin);
if (sensorValue > 200){
Serial.write('d');
delay(100);
}
}
You can see how easy it is to add layers of smarts to your system.
No comments:
Post a Comment