I'm trying to control this RGBW LED driver over IR from an Espruino Pico. I'm using the record-replay code provided in the tutorial, but it works only occasionally. Sometimes it works multiple times in a row, then nothing for another 100 attempts (spamming the command). Both the remote and the Pico generates the output 100000000111111110000001011111101 repeatedly. Below is the recorded times.
pinMode(A5,"input_pullup");
var times = [];
/* The ID of the watch we're using to record IR. We want to
turn it off while we transmit in case we record outselves! */
var currentWatch;
function startWatching() {
currentWatch = setWatch(function(e) {
// work out how long the pulse was, in milliseconds
var pulseLen = 1000 * (e.time - e.lastTime);
// then save it, if it was less than 1 second
if (pulseLen < 1000) {
times.push(pulseLen);
} else {
times = [];
}
}, A5, {repeat:true});
}
startWatching();
function stopWatching() {
clearWatch(currentWatch);
currentWatch = null;
}
function replay() {
//Stop timer
if(currentWatch !== null) stopWatching();
//Light up LED1
digitalWrite(LED1,1);
// Start the 38kHz square wave
analogWrite(B8,0.9,{freq:38000});
// Send the pulses
digitalPulse(B9, 1, times);
// Wait until pulsing is finished
digitalPulse(B9, 1, 0);
// Turn LED1 off
digitalWrite(LED1,0);
}
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi everyone!
I'm trying to control this RGBW LED driver over IR from an Espruino Pico. I'm using the record-replay code provided in the tutorial, but it works only occasionally. Sometimes it works multiple times in a row, then nothing for another 100 attempts (spamming the command). Both the remote and the Pico generates the output 100000000111111110000001011111101 repeatedly. Below is the recorded times.
Pico code:
Any suggestions?
Thanks and best regards,
Maarten