The following code was somewhat anticlimactic in that you can't see anything. The nature of the remote controls, and infrared lights, is that the sequence is fast and invisible to the naked eye. Unfortunately we still need to purchase an IR LED, so we weren't able to perform the ultimate test: can we actually take a picture with this bugger? In the end, we elongated the lengths of the light flashes, and plopped a regular old LED in our hardware, and were rewarded with a happy little flicker. More on wether we can actually take pictures with it later.
The Code:
unsigned long start = micros();
while(micros()-start<=time){
}
}
void high(unsigned int time, int freq, int pinLED){
int pause = (1000/freq/2)-4;
unsigned long start = micros();
while(micros()-start<=time){
digitalWrite(pinLED,HIGH);
delayMicroseconds(pause);
digitalWrite(pinLED,LOW);
delayMicroseconds(pause);
}
void setup(){
}
void loop(){
int _freq = 40;
int _pin = 9;
high(2000,_freq,_pin);
wait(27830);
high(390,_freq,_pin);
wait(1580);
high(410,_freq,_pin);
wait(3580);
high(400,_freq,_pin);
delay(5000);
}
void wait(unsigned int time){
}
No comments:
Post a Comment