Pequeno pico problemo

Posted on
  • Heya! My new pico came in the mail today! Thanks!

    Some quick questions -- new to Espruino but hopefully I'm not going batty:

    So, I've saved the following code:

    var doStuff = function() {
    LED2.set();
    setTimeout(function() { LED2.reset(); }, 5000);
    };

    function onInit() {
    doStuff();

    setWatch(function() {

    digitalPulse(LED1, 1, 50);
    

    }, BTN, { repeat: true, debounce : 50, edge: "rising" });
    }

    run it, it works great plug it in again and connect using the web IDE -- works great.

    Now, pull it out of the usb port, and plug it back in again, but don't connect using the Web IDE, nothing happens... connect using the Web IDE, in business again.

    If I pull it out of the usb port, and push it in only until the outer pins connect, things work.

    if I slooowly push it in... things work until the middle pins connect.

    Is there a way to not have it halt the interpreter once the inner pins make contact?

    Also -- I've tried using two different USB battery power packs (such as http://www.amazon.com/Anker-13000mAh-Capacity-Portable-Technology/dp/B00BQ5KHJW/ref=sr_1_14?s=electronics&ie=UTF8&qid=1429927557&sr=1-14&keywords=usb+battery+power+pack) with the thought that I'd have an awesome really long lasting power supply that's easy to manage... the other is has a little solar panel too...

    but either of them won't power the pico -- I'm guessing that the pico is sipping too little power for the pack to recognize it (it being designed for power gulping devices) .... any thoughts on this? Same thing with a wall charger that I tried...


  • Hi,

    The issue you're having is expected I'm afraid. What happens is Espruino detects that it is connected to USB and sends a few characters, but nothing on the PC is reading the data and so the pico just sits there waiting.

    If you connect to the port on the pc with any program (not just the ide) then the pico will start working. I do plan to fix it soon though.

    As far as usb power, lack of power draw could be your problem. Maybe try putting a low value (100 ohm? ) resistor between gnd and 5v and see if it starts working.

  • To make something like the solar panel battery truly long life, you could crack it open and connect straight to the battery inside - as Espruino will be totally happy running off 3.7v

    Often even when you do get the packs running, the power supply in them isn't very efficient when not supplying much power, and they don't last as long as you'd expect.

  • @Gordon Just so I understand all this..... onInit(); isn't needed at the bottom of the script? Did something change in the Espruino to auto run onInit() at initial powerup?

  • It's only needed if you want to get everything working as soon as you upload the code.

    After a save it makes no difference - in fact if you're using setInterval in onInit (without a clearInterval before) then it might actually be better not to have the call at the bottom of your code, or you might end up with two sets of intervals!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Pequeno pico problemo

Posted by Avatar for Oceanswave @Oceanswave

Actions