Most recent activity
-
As for the extra features - just by looking at these pictures - Iskra definitely looks more appealing and user friendly because of clear pin labels. I really hate looking up the Espruino reference just to double check where PWM or ADC is, and for that reason alone I would often choose Arduino for simple toy projects.
The good thing is you can get improvements/ideas like that back to Espruino when the time comes for your next kickstarter campaign - which I will happily support :)
-
- 6 comments
- 3,778 views
-
@allObjects thanks to your suggestions I have played with different timers and debounce values again and I think I'm getting somewhere.
@Gordon it's even less reliable this way, it's difficult to describe LED's behavior now so I have changed the code to use
console.log
and it looks interesting.First try:
var door = new Pin(A8); //pull-up E.on("init", function () { door.mode("input"); }); function doorOpenedHandler() { console.log("door opened"); } function doorClosedHandler() { console.log("door closed"); } setWatch(function () { doorOpenedHandler(); }, door, {repeat: true, edge: "falling", debounce: 500}); setWatch(function () { doorClosedHandler(); }, door, {repeat: true, edge: "rising", debounce: 500});
1v81 Copyright 2015 G.Williams >echo(0); =undefined >save() =undefined Erasing Flash..... Writing..... Compressed 81600 bytes to 2942 Checking... Done! // I'm starting with closed switch door closed >door.read() =true // I'm opening the switch door opened >door.read() =false // I'm closing the switch door opened >door.read() =true // wait, what? wrong handler got called but the door value is correct
Now let's try with
e.state
:... setWatch(function (e) { if (e.state) {doorOpenedHandler();} else {doorClosedHandler();} }, door, {repeat: true, edge: "both", debounce: 500});
// I'm starting with closed switch again, looks like the logic has changed door opened >door.read() =true // I'm opening the switch door closed >door.read() =false // I'm closing the switch door opened >door.read() =true // I'm opening the switch door closed // I'm closing the switch door closed // wrong handler again i.e. after seeing "door closed" the last time I would expect "door opened" now
Any ideas, please? Is my wiring ok?
-
Hello, I'm having problems with Pico and magnetic reed switches.
The idea is that on board LED indicate state of that switch i.e. green LED on when open, green LED off when closed. It all works well at first but when I quickly toggle the switch for a little while then LED gets "out of sync" with my switch, that is it lights green when closed.
I'm having this issue both with pull-up and pull-down connections, tried with a different switch and debounce values. I must be missing something - but what? :)
Example code:
var door = new Pin(A8); var ledOpen = LED2; var ledHold = LED1; E.on("init", function () { door.mode("input"); }); function doorOpenedHandler() { ledOpen.set(); } function doorHeldHandler() { ledHold.set(); } function doorClosedHandler() { ledOpen.reset(); ledHold.reset(); } setWatch(function () { doorOpenedHandler(); }, door, {repeat: true, edge: "falling", debounce: 0}); setWatch(function () { doorHeldHandler(); }, door, {repeat: true, edge: "falling", debounce: 2000}); setWatch(function () { doorClosedHandler(); }, door, {repeat: true, edge: "rising", debounce: 0});
-
-
-
@DrAzzy I will try to get hold of a multimeter tomorrow and answer your question. For now I can only say that it's a one channel Arduino relay module connected with Espruino Board with shared GND, IN to C9 and VCC to VBat. I should also clarify that it fails when no explicit pin mode specified by me, but works when I set pin mode to "output" beforehand.
And don't get me wrong guys, I'm not claiming that there is no good explanation for this behaviour. All I'm saying is that it has nothing to do with beginners friendliness :)
-
Ehh say what you want but for me (that is a beginner with no understanding of Figure 16) this whole thing is getting hairy.
After reading example codes I assumed that
pin.write(!pin.read())
simply toggles given pin right? Well no, it turns out it's not that simple. It works like a toggle for an LED, but it doesn't work for a relay module.Yes you said charging capacitors and square waves, but I say toggling is more likely a beginner's thing.
Hello.
I just stumbled on Ecma TC53 and want to bring it to your attention in case if you missed it - searching these forums returned zero items. Turns out, there is a formal group of people working on standardizing JavaScript for embedded systems specifically.
I guess it doesn't make much financial sense for @Gordon to attend these meetings, but still as a creator of the most successful (in my eyes) JS engine|interpreter, he should have a say.
It may also be in Espruino's interest to explore it further.
So here is a link: https://www.ecma-international.org/memento/tc53.htm
The IO Class Pattern proposal looks interesting: https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/io/io.md#tc53-io-a-new-take-on-javascript-inputoutput-on-microcontrollers