-
Update for Espruino board since it only has 3 lights... Also added ability to stop and restart it. Change the value of
i
to control how fast the lights change (in milliseconds), by defaultrun=true
, setting tofalse
will stop it. You can now resume by settingrun=true
again. Enjoy!var i = 1000, run = true; function flashLights() { LED3.write(false); LED1.write(true); setTimeout(function () { LED1.write(false); LED2.write(true); setTimeout(function () { LED2.write(false); LED3.write(true); setTimeout(function () { if (run) { flashLights(); } else { var checkForRestart = setInterval(function () { if (run) { clearInterval(checkForRestart); flashLights(); } }, 500); } }, i); }, i); }, i); } flashLights();
-
Awesome, thanks for the very thorough response! I haven't received my Espruino (starter kit) yet, but I had bought an STM32F4Discovery a few months ago that I've been playing with in the mean time. I had written a small program to cycle the state (0 to 1 and back) of the A2 pin every 3 seconds on my board last night, and was checking it with a digital multi-meter to see if it was pulled to ground, but didn't realize that reading the pin value would cause it to float as the voltage never changed much. Guess I should've used an analog meter to see it "bounce" from being pulled to ground. I was doing
console.log(A2.read())
immediately after setting the pin, so it was probably too fast for the digital meter to pick up that it gained or lost voltage before floating.Hopefully I can wire it directly like you have mentioned above that would be preferable (and what I was attempting last night), if not then I'll go the relay route. I'm pretty sure the 2nd wire on reset is chassis ground, I'll check tonight after work...
-
What's the easiest way to "connect" 2 pins? Should I use digitalWrite, pin.write with a timeout, analogWrite, or something else? Also should I use 2 pins, or can I use 1 pin with ground? I'm wanting to use Espruino to "press" the reset button on a PC by wiring the green/black wires to it...
Thanks,
Austin -
-
-
-
-
Just got espruino running on a stm32f4discovery I ordered and received today... I'm a backer on kickstarter, but am beyond the "impatient developer" level...LOL!
Anyway, here's a cool little demo you can run on the the f4discovery board:
var i = 1000, run = true; function flashLights() { LED4.write(false); LED1.write(true); setTimeout(function () { LED1.write(false); LED2.write(true); setTimeout(function () { LED2.write(false); LED3.write(true); setTimeout(function () { LED3.write(false); LED4.write(true); setTimeout(function () { if (run) { flashLights(); } }, i); }, i); }, i); }, i); } flashLights();
After executing it runs each of the leds in a circle with the given wait time between each flash. In the console you can modify the
i
variable to alter the flash rate while it's running. Then to stop it just putrun=false
. Once you get belowi=70
you can't even really tell which direction they're flashing in they're going so fast!Cheers,
Austin
So I've checked my PC, the reset pin is indeed being grounded from 3v3... And was able to test the Espruino board (just got the "official" one last night), that the C8 pin when trigger will "short" the pin to ground. So that'll work out perfectly! Thanks again for the hlep
Cheers,
Austin