What to exepect coming from Nodejs 7+ #654
Replies: 9 comments
-
Posted at 2016-11-23 by @gfwilliams I think it's probably best if someone less biased provides their feedback, but:
Basically, if you just write JS code and use the modules that are available for Espruino (which tend to be quite memory efficient) then everything will be great. If you expect to use a module for everything rather than just using the standard API functions then you'll probably be disappointed. Espruino isn't a Raspberry Pi - you need to think of it more like an Arduino for JS devs. You get really low power consumption, <0.1s boot time that always powers on in the same state and a small size - but there are some compromises (but far less than if you had to write C on an Arduino!) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-11-23 by @allObjects Issue or challenge... I'd rather focus on the latter...
That statement is key! Device with totally different purpose and context constraints - enablers and inhibitors. 1.024E+5 vs 1.024E+9, single vs quad core, 84MHz vs 2.8+GHz, deep sleep vs idle, 0.12mA vs 200mA, running on source vs JIT c'd,... Nevertheless IS exciting to code on both sides of the fence... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-11-23 by @gfwilliams
I think it's nearer 0.02mA now on the Pico, or 0.002mA on Puck.js ;) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-11-23 by dgk @gordon that was an excellent reply, exactly what I needed to know. This information should be in some form in their FAQ/Docs/Wiki since more than likely an Espruino adopter would be coming from coding nodejs. It's absence prompted me to use the forum. (espruino folks listening here?) So summarizing your post I should expect to just write code that calls the API mostly. There is a package manager and module system (still commonjs?) but use it sparingly if at all. Don't count on using any package from NPM unless it has very few or no dependencies. At least for now there is limited ES6. Actually being an ole geezer I can remember the good old days of the first IBM PCs and trying to get your (FORTRAN/BASIC) program to fit into 128K. It's back to the future..fun |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-11-23 by @gfwilliams Thanks! Yes, I'll try and add something... The packaging is commonjs-style, but quite basic. If you You can set up a directory locally and grab modules from that, or can even just require a URL if you want to load something up directly. There are also command-line tools ( But basically: if you spend your time trying to copy your existing Node.js projects you will probably get frustrated. Approach it as you said - with the attitude that you're working on a constrained device - and writing code for it will be fun. It's worth reading http://www.espruino.com/Performance I'd also really recommend using the REPL in the IDE heavily as well, especially when dealing with hardware - being able to 'poke around' from inside the CPU is fun, and when you get used to doing it it'll save you hours of debugging. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-11-23 by Wilberforce It is also worth noting that there is a Linux build, so you can test out on the raspberry pi. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-11-23 by @allObjects @gordon...
0.066 ... 0.0066 Watts compared to 1.0 ... 0.4 Watts? - tips the scale even more towards destiny... ;-) There was a time where power consumption was so beyond reasonable for unplugged use that (power) wire(s) were accepted without comment. With the tizillion IoT things we would suffocate in wires, worse than anything in a spider's web... Though we still have (www) communication is because the grid of connection points is much finer and multi-layered... @user70533
exactly, same principles apply: focus on the essential, distill the solution down to a the point where |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-11-24 by the1laz @user70533 the espruino website has a lot of info for getting started. http://www.espruino.com/Modules shows how to use modules and http://www.espruino.com/Reference has details about everything built-in. On the whole, I've been able to easily port code between node and espruino and just replace the modules and their calls with equivalents, it didn't take long to get used to. Definitely a lot easier, more powerful and faster than making a jump to writing c for arduino, and having a command line to work with on your microcontroller is amazing! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-11-26 by CanyonCasa I think @gordon summed it up well, but in addition to the constraints the application space differs too. As a microcontroller, the Espruino efficiently handles sensor and actuator device interfaces to collect and process real world data. NodeJS on the other hand builds Internet web services. Personally, I don't favor the notion of using an OS dependent system such as NodeJS to triddle hardware, nor the naive idea of exposing a primitive microcontroller board like Espruino directly to the Internet. Remember Maslow's hammer -- when all you have is a hammer, everything looks likes a nail. Espruino and NodeJS, while both JavaScript based give us two different tools, so choose the best tool for the job. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2016-11-22 by dgk
I am set to buy a couple espurinos. I've been coding for RPi so I can use the latest node 7 (in linux).
Can someone summarize the major issues I will have coding for/with espruino?
examples: Supports CommonJS? (i.e. can use npm??), I use node-serialport, but there is no binary for espruino right?? can I use socket.io? How about any ES6? Promises?, all of ES2015 supported except what was mentioned (no regular expressions :( )?
Just wanting to have a better idea of what I am getting into.
Beta Was this translation helpful? Give feedback.
All reactions