-
i'm not sure I understand what you mean, but for the time being, the issue is resolved. i just wanted to understand exactly what limitations there are on watches interfering.
the encoders i'm using: https://www.amazon.com/Cylewet-Encoder-15%C3%9716-5-Arduino-CYT1062/dp/B06XQTHDRR/ref=sr_1_4?ie=UTF8&qid=1522902358&sr=8-4&keywords=rotary+encoder -
-
I know in the docs it says you can't mix pins like A0 and B0 because they end in the same number, but it appears it goes for A2 / B12 as well. Is this right??
Assuming I want to use all my available pins for setWatch, does that limit me to 10 max?I have a project where I am using 2 pins for I2c and then I need 9 pins watched for 3 rotary encoders with buttons. Is this doable on the pico or original espruino? if not, what are my multiplexing options? (i'm a beginner with muxing)
-
-
-
-
tried putting timeout in E.on('init') - nothing. it almost seems as if the init function does not get called when the device is plugged into power.
if i plug it in, connect it to the ide, and then run load(), then it works as intended, but otherwise it doesnt look like it's working. any way to debug?in fact, try running this and let me know if it works:
function ledInit() { digitalPulse(LED1,1,200); digitalPulse(LED2,1,400); } E.on('init',function() { USB.setConsole(); console.log('ini'); ledInit(); setTimeout(ledInit,2000); });
for me, it only works when i run load() from command line.. on powerup, nothing happens
-
Yes, i changed it to I2C2 and no, the timeout was just inline. I will try it inside the init. As it is, I'm still a bit unsure of execution. It seems when I send the code to the device, it gets executed immediately. that does not, however, happen when plugging it in? I thought the code gets parse every time it's powered on.
-
Hello,
i'm writing a simple timer using an Adafruit 7 segment display which uses I2C.
I have made a working prototype using the original kickstarted Espruino and wanted to transfer the design to the pico.
The display requires initialization which I do in an E.on('init') as well as inline:function ledInit() { I2C1.setup({scl:B6, sda:B7}); initAddr = (addr) => { I2C1.writeTo(addr, 0x21); // clock on I2C1.writeTo(addr, 0x81); // flash I2C1.writeTo(addr, 0xE0 | 3); // brightness 15 }; initAddr(0x70); } E.on('init', function() { //doesn't work on pico USB.setConsole(); digitalPulse(LED2,1,200); ledInit(); } ledInit(); //doesn't work on pico
For the pico, i changed the pins to B10 and B3
The problem is that while i'm on USB, the init works just fine. However, when I save the code and run it with a battery, the LED init fails. I later tried to call the init on BTN1 and that works fine. Something about initial power that's not working. I tried setTimeout to call it and that fails as well.
I also tried the USB.console trick and that didn't help.setTimeout(ledInit,2000); // doesn't work setWatch(ledInit, BTN1, { repeat: true, debounce: 50 }); // works but is less than ideal
Any ideas?
I'm running latest firmware available -
-
I just got my Espruino and wanted to see if i can make a touch switch from it. I wrote a small program to read analog values of pin C7 (random choice here) ..
while it works fairly reliably when I touch the pin, i do this by setting up an interval to check the value every 200ms. I'm wondering what the resolution of the polling is. Can I poll every 100ms? every 10ms?
I have a project where I'd like to pulse a buzzer. right now i'm using setInterval as I read that digitalPulse should only be used for short durations (in the microseconds). I also recently realized that pwm can be used for this purpose.
the one thing i dont like about setInterval is that it makes the code harder to read with various nested intervals if I want to have different buzz patterns. why does it say digitalpulse should only be used for short intervals? is there some problem if I want to have it on for a second? or a half second?
which of these will yield best power utilization as well? it's not super-critical but if one is 10x more power than another, i'll do the power efficient one.
thanks!