Hi to all,
I'm trying to use arduino to control a roomba vaccum cleaning robot.
My project has a very simple IR Led and a 100 OHM resistor connected to the board.
I found this pronto code:
http://www.robotreviews.com/chat/viewtopic.php?t=8682#p64966
For clean:
0000 0069 0000 0008 0071 0027 0023 0071 0023 0071 0023 0071 0071 0027 0023 0071 0023 0071 0023 030B
I read all the documentation about Pronto code, and I was able to understand that
Frequency (hz) is: 39478
1 Cycle (ms) is: 0.025330563858351
First burst pair: 0
Second burst pairs: 8
0071 0027 means 0
0023 0071 means 1
So the string to send (3 times) is: 01110111
Well.....
The first thing I though is to use irlibrary... but how? SendRaw(X,Y,Z) with X a vector of hex converter to decimal, Y ?? Z=8???
I made several trials but I could'nt figure it out..
I found a script at:
http://l8ter.com/arduino/index.php
That's generate this code
int pinIRLED = 13; // assign the Infrared emitter/ diode to pin 13
void setup() {
pinMode(pinIRLED, OUTPUT); // set the pin as an output
}
// sets the pulse of the IR signal.
void pulseON(int pulseTime) {
unsigned long endPulse = micros() + pulseTime; // create the microseconds to pulse for
while( micros() < endPulse) {
digitalWrite(pinIRLED, HIGH); // turn IR on
delayMicroseconds(13); // half the clock cycle for 38Khz (26.32×10-6s) - e.g. the 'on' part of our wave
digitalWrite(pinIRLED, LOW); // turn IR off
delayMicroseconds(13); // delay for the other half of the cycle to generate wave/ oscillation
}
}
void pulseOFF(unsigned long startDelay) {
unsigned long endDelay = micros() + startDelay; // create the microseconds to delay for
while(micros() < endDelay);
}
void takePicture() {
for (int i=0; i < 2; i++) {
pulseOFF(2862);
pulseON(988);
pulseOFF(887);
pulseON(2862);
pulseOFF(887);
pulseON(2862);
pulseOFF(887);
pulseON(2862);
pulseOFF(2862);
pulseON(988);
pulseOFF(887);
pulseON(2862);
pulseOFF(887);
pulseON(2862);
pulseOFF(887);
pulseON(19733);
} // loop the signal twice.
}
void loop() {
takePicture(); // take the picture
delay(5000); // delay in milliseconds which allows us to do timelapse photography - 1 second = 1000 milliseconds
}
It seems to be wrong (it start with pulse off..) and in fact it doesn't work.. I try to invert pulse on/off (the timing seems to be correct) but it still doesn't work also if I repeat it 3 times (not 2 as the script do )
I have no idea on how I can figure it out and make my project work.. Please help me.
NB I read all the documentation regarding pronto code from remote central and from other website, I manually decodify it, I try to be accurate in defining the right frequency and cycle...
NB2 I don't have the original remote, so I can't use irLibrary to decode the signals