-
• #2
Hi - are you doing this with a normal Espruino, or Puck.js?
On normal Espruino it should be as easy as:
var pulseTimes = [4400,4350,550,1600,600,500,550,1650,550,1600,550,550,550,550,550,1600,550,550,550,550,550,1600,550,550,550,550,550,1600,550,1600,600,500,550,1650,550,550,550,1600,550,1600,600,1600,550,1600,550,550,550,1600,600,1600,550,1600,600,500,550,550,550,550,550,500,600,1600,550,550,550,500,600,1600,550,1600,600,1600,550,550,550,500,600,500,550,550,550,550,550,500,600,500,550,550,550,1600,600,1600,550,1600,550,1650,550,1600,550].map(function(x) {return x/1000;}); analogWrite(IR_ANODE,0.9,{freq:38000}); digitalPulse(IR_CATHODE, 1, pulseTimes); digitalPulse(IR_CATHODE, 1, 0); digitalRead(IR_ANODE);
So all I did is divide the times by 1000 to get them in milliseconds rather than microseconds.
-
• #3
Hi Gordon,
Thanks for responding. Actually the AirCon. has a longer IR Codes, It has 199 bits. So far I only found appropriate code for OFF :(
Is there any way I can decode longer IR signals, I am always getting memory out of error using Espruino using official decoded method (like the instructions on Youtube)
Thanks
Navas -
• #4
Also, I finally figured out the code using espruino. It works with Puck.JS, but ot doesn't work on my Pico, Any ideas?
var on = [4.41455841064,4.36687469482,0.57029724121,1.61373615264,0.56827068328,0.55217742919,0.54073333740,1.62029266357,0.56457519531,1.61266326904,0.56934356689,0.55313110351,0.54073333740,0.55301189422,0.54085254669,1.61361694335,0.56552886962,0.55694580078,0.53882598876,0.55599212646,0.53977966308,1.61743164062,0.56743621826,0.55408477783,0.54073333740,0.55313110351,0.53977966308,1.61361694335,0.56743621826,1.61075592041,0.56934356689,0.55408477783,0.54061412811,1.61945819854,0.56743621826,1.62029266357,0.56743621826,0.55313110351,0.54073333740,1.61647796630,0.56743621826,1.61552429199,0.56648254394,1.61170959472,0.57029724121,1.64043903350,0.54156780242,1.64020061492,0.54180622100,1.61361694335,0.56934356689,0.55611133575,0.54061412811,1.61266326904,0.56838989257,0.55408477783,0.53977966308,0.55313110351,0.54073333740,0.55325031280,0.53966045379,0.55408477783,0.53977966308,0.55408477783,0.53977966308,0.55503845214,0.53977966308,0.55599212646,0.53977966308,1.61457061767,0.56648254394,1.61349773406,0.56755542755,0.55408477783,0.53977966308,0.55408477783,0.53882598876,0.55408477783,0.53977966308,0.55313110351,0.53977966308,0.55599212646,0.53977966308,1.61647796630,0.56648254394,0.55420398712,0.53966045379,0.55313110351,0.53966045379,1.61373615264,0.56743621826,1.61457061767,0.56648254394,1.61647796630,0.56552886962,1.64127349853,0.53977966308,1.61647796630,0.57792663574,5.18798828125,4.41646575927,4.36210632324,0.57125091552,1.64031982421,0.54168701171,0.55217742919,0.54168701171,1.61743164062,0.56648254394,1.61445140838,0.56755542755,0.55408477783,0.53977966308,0.55313110351,0.54073333740,1.61457061767,0.56648254394,0.55599212646,0.53977966308,0.55503845214,0.54073333740,1.64413452148,0.54073333740,0.55313110351,0.54061412811,0.55325031280,0.53977966308,1.61457061767,0.56648254394,1.61552429199,0.56648254394,0.55313110351,0.54073333740,1.61838531494,0.56838989257,1.62124633789,0.56648254394,0.55408477783,0.53882598876,1.64508819580,0.54073333740,1.61266326904,0.56838989257,1.61552429199,0.56648254394,1.61266326904,0.56838989257,1.61361694335,0.56838989257,1.61743164062,0.56552886962,0.55694580078,0.54073333740,1.61552429199,0.56457519531,0.55408477783,0.53977966308,0.55313110351,0.54073333740,0.55408477783,0.53882598876,0.55408477783,0.53977966308,0.55313110351,0.53977966308,0.55599212646,0.53977966308,0.55503845214,0.54073333740,1.61552429199,0.56552886962,1.61361694335,0.56648254394,0.55503845214,0.54073333740,0.55313110351,0.53977966308,0.55408477783,0.53977966308,0.55313110351,0.53977966308,0.55599212646,0.54073333740,1.61457061767,0.56827068328,0.55325031280,0.54073333740,0.52928924560,0.56457519531,1.61361694335,0.56743621826,1.61361694335,0.56838989257,1.61278247833,0.56922435760,1.61361694335,0.56743621826,1.61743164062,0.57792663574]; var off = [4.44984436035,4.37164306640,0.57315826416,1.61933898925,0.56934356689,0.55599212646,0.54168701171,1.62410736083,0.56743621826,1.61933898925,0.56934356689,0.55503845214,0.54168701171,0.55503845214,0.54168701171,1.61743164062,0.57029724121,0.55789947509,0.54073333740,0.55789947509,0.54073333740,1.62220001220,0.56743621826,0.55599212646,0.54073333740,0.55503845214,0.54168701171,1.61743164062,0.56743621826,1.62029266357,0.56648254394,0.55503845214,0.54073333740,1.62410736083,0.56838989257,0.55694580078,0.54073333740,1.61564350128,0.57017803192,1.62029266357,0.56552886962,1.61838531494,0.56838989257,1.61933898925,0.56648254394,0.55503845214,0.54061412811,1.62231922149,0.56743621826,1.64699554443,0.54073333740,1.62410736083,0.56934356689,0.55408477783,0.54073333740,0.55503845214,0.54073333740,0.55503845214,0.54061412811,0.55515766143,0.54073333740,1.61743164062,0.56838989257,0.55503845214,0.54073333740,0.55694580078,0.54073333740,1.62315368652,0.56934356689,1.61647796630,0.56838989257,1.64413452148,0.54275989532,0.55491924285,0.54073333740,0.55408477783,0.54073333740,0.55408477783,0.54073333740,0.55503845214,0.54073333740,0.55694580078,0.54073333740,0.55694580078,0.54061412811,0.55420398712,0.54168701171,0.55503845214,0.54073333740,1.62029266357,0.56838989257,1.61743164062,0.56838989257,1.61933898925,0.56648254394,1.61743164062,0.56838989257,1.61838531494,0.58078765869,5.22613525390,4.41932678222,4.37355041503,0.57125091552,1.61647796630,0.56838989257,0.55599212646,0.54073333740,1.64794921875,0.54168701171,1.61838531494,0.56648254394,0.55503845214,0.54168701171,0.55503845214,0.53977966308,1.61933898925,0.56743621826,0.55599212646,0.54168701171,0.55694580078,0.54073333740,1.62208080291,0.56850910186,0.55408477783,0.54168701171,0.55408477783,0.54073333740,1.61838531494,0.56743621826,1.61743164062,0.56838989257,0.55503845214,0.54073333740,1.64890289306,0.54264068603,0.55694580078,0.54073333740,1.61743164062,0.56743621826,1.61743164062,0.56838989257,1.61743164062,0.56838989257,1.61933898925,0.56743621826,0.55503845214,0.54073333740,1.62220001220,0.56838989257,1.61838531494,0.56934356689,1.62315368652,0.56934356689,0.55503845214,0.54156780242,0.55420398712,0.54073333740,0.55503845214,0.54168701171,0.55408477783,0.54073333740,1.62029266357,0.56648254394,0.55420398712,0.54156780242,0.55706501007,0.54061412811,1.62506103515,0.56743621826,1.61838531494,0.56648254394,1.61743164062,0.56934356689,0.55515766143,0.54061412811,0.55503845214,0.54073333740,0.53119659423,0.56457519531,0.53024291992,0.56457519531,0.53310394287,0.56457519531,0.53215026855,0.56552886962,0.55503845214,0.53977966308,0.55503845214,0.53977966308,1.62315368652,0.56743621826,1.61933898925,0.56636333465,1.61743164062,0.56850910186,1.61743164062,0.56934356689,1.62029266357,0.57983398437]; function ac(cmd){ digitalWrite(LED1,1); analogWrite(A5,0.9,{freq:38000}); digitalPulse(A6, 1, cmd); digitalPulse(A6, 1, 0); digitalRead(A5); digitalWrite(LED1,0); }
-
• #5
It is working on the official Espruino Pico. Still trying to figure out on ESP8266.
Thanks
Navas -
• #6
ESP8266 won't work I'm afraid - it can't generate the 38kHz oscillation needed at the moment with its software PWM.
If you want to save some memory, you can do:
var off = new Float32Array([4.44984436035,4.37164306640 .... ]);
It'll put the data into a typed array, which will be much more memory-efficient.
-
• #8
Or you could use Espruino WiFi, which would work perfectly :)
-
• #9
Yup!, that's what I did for one of my AC. And for another one, I ended up using Arduino.
My budget is tight, so I can't afford to have multiple espruino Wifi :(
I heard there is a way to use IRQ and make it work on esp8266. Is there any work in progress?
I miss RGB Control (not the neo pixel) and IR stuffs since it lacks PWM support. Those are the two things I use mostly.
Thanks
Navas -
• #10
I heard there is a way to use IRQ and make it work on esp8266. Is there any work in progress?
Not as far as I know. I'm trying to use the patreon page to get some funds to look into ESP8266 a bit more, so I guess at some point that might happen.
However I think at some point WiFi takes priority over everything, so it might never be reliable.
since it lacks PWM support
Soft PWM does work ok. It seems to be ok-ish for ~100Hz or so, which might work for your lighting?
-
• #11
Here you go buddy.
Thanks for letting me know the patreon page.
And for RGB, controlling individual pins with each 100Hz works? I tried with one and seems like worked with OK, but haven't tried with all 3 pins.
-
• #12
Thanks! That's great!
Yes, 3x 100Hz should work ok - it might glitch very occasionally, but it's usable.
The way it's implemented, 3x 100Hz has about the same load as 1x 300Hz - so it should be fine. If you need more PWM you could always try lowering the frequency.
Hi,
I was trying to send IR code for my Aircondition unit. Unfortunately, none of the methods (hopefully) listed on the espruino website works for me, I was able to deduct the IR code using Arduino and found the following code.
How do I send the equivalent code from Espruino? (there is no pronto code listed on irdb.tk)
Thanks
Navas