Puck.js - the ground-breaking bluetooth beacon
Heater.
Posts: 21,230
Get your Bluetooth Low Energy adapter now: https://www.kickstarter.com/projects/gfw/puckjs-the-ground-breaking-bluetooth-beacon
I try not to advertise other peoples products here but this is usable with the Propeller. And it is by Gordon Williams who brought us the Espruino Javascript engine that may well run on the P2 one day.
Gordon just needs a few more pledges in to meet the last stretch goal then he has promised to work on IPv6 over BLE for the Puck. Which would be great.
Only 56 hours to go!
I try not to advertise other peoples products here but this is usable with the Propeller. And it is by Gordon Williams who brought us the Espruino Javascript engine that may well run on the P2 one day.
Gordon just needs a few more pledges in to meet the last stretch goal then he has promised to work on IPv6 over BLE for the Puck. Which would be great.
Only 56 hours to go!
Comments
You mean you want to spell "Puck.js" with a "F" ?
OK, how about a positive value pledge and you just program the thing in C++ using the tool chain that Gordon will provide. There will be a lot of support functionality in there you can reuse
I picked up Function Programming in JavaScript recently as part of Packt's Free Learning offer. While I think the book could have used better proofreading, the content itself was very good! For $10 (eBook version), you'll get a decent introduction to functional programming (if you don't already know it) and an excellent explanation of how to get functional with JavaScript.
Just now I have been getting back to my old favorite methodology, Communicating Sequential Processes (CSP). See below. Note how there are two "processes" running there exchanging messages in a do forever loop in there. Normally not a good idea in JS.
Sadly this won't work on Espruino as it does not support ES6 generators.
CSP would be a great thing to have on the P2 what with all the COGs it has.
Communicating Sequential Processes?
Interesting use of generators and message-passing. It all generally makes sense, except the run parameters. Are those necessary, or were you just showing how parameter values are be passed?
Well spotted. Yes, I meant "Communicating Sequential Processes", no idea how my fingers typed totally the wrong thing.
Yes, the "[ 'parm1', 'param2' ]" thing is just there to show how parameters can be passed to the process to be run. Not used here.
Actually I'm not so happy with the "this.run.bind(this)" thing. This is an experiment in using CSP with ES6 class. And here I am having to mess around with 'bind' to get 'this' to work. I'd rather have "this.run". I'm not sure why csp.go can't run the given function with the current 'this''. If you see what I mean.
I see your example contains this: When was the "class" keyword added?
I'm not sure I like it much. Object oriented programming can get silly. Especially with inheritance. Anyway it was easy enough to make such classes in JS before.
I suspect the ECMAScript standards committee has become infested with Java programmers who think that JS is a broken Java that needs fixing rather than a totally different language. We can expect them to shoehorn junk like types, public this, private that etc into the standard in the coming years. And JS will be bastardized into a horrible mess.
On the bright side, a lot of those ES6 features, some of which are pretty neat, are already implemented in the main browsers, Firefox, Chrome, Edge. So I just use them. If someone can't get it to work in some old IE I have no sympathy.
http://kangax.github.io/compat-table/es6/
The changes are always backwards compatible. They do not break your old code. Unlike some other languages, cough, python.
But, you have a point. What if I want to use new ES6 features but I want my code to work in older browsers?
No problem. Just run your ES6 source through a transpiler. Notably babel.js https://babeljs.io/ and serve that up as ES5.
Of course that is a bit silly, the new browsers already have a lot of the new features. Users have a choice of at least two open source browsers. Those incarcerated in Windows have the Edge. I have the luxury of not having to support old junk
Tempting as it is to blame JavaScript, this seems to be an issue with the libraries surrounding JS. Those change by the minute it seems. I doubt it'll calm down soon.
But...it's already funded. It's going to happen.
I notice the Bluetooth minders have a Bluetooth "gateway" that is supposed to work with node and on a Raspi even. Of course they want you to register bla, bla to try it. So I don't.
Hence wanting to encourage Gordon Williams to provide such a gateway, that is free, open source, and usable anywhere.
What I'm talking about is the £100,000 stretch goal which gets us:
"Add support for IPv6 over Bluetooth to Puck.js, as well as Raspberry Pi hub software (this would be a firmware update after shipping, to avoid any delays)"
Which would be nice.
I did not see the stretch goal on the link:
https://www.kickstarter.com/projects/gfw/puckjs-the-ground-breaking-bluetooth-beacon
Looks like it's about 4000 pounds short.
Puck.js just made it's 100,000 stretch goal. With only 36 hours to go. https://www.kickstarter.com/projects/gfw/puckjs-the-ground-breaking-bluetooth-beacon/posts/1643002
More Javascript goodness coming to the world.
Now the long wait till delivery in December.
Should be just in time to hook up to a P2 chip right?
https://www.kickstarter.com/projects/onion/omega2-5-iot-computer-with-wi-fi-powered-by-linux
I'm guessing its some version of a Qualcomm/Atheros MIPS system-on-chip. As used in many cheap home WIFI routers. And used in this board:
http://hackerboards.com/tiny-wifi-loaded-openwrt-com-starts-at-12/
It's smaller than I thought it would be. The PCB is about 28.5mm across.
I'm off to figure out what I'm supposed to do with it now.