Basic Electron Question : compiling

I was very happy to get the electron and try some cellular arduino action.

However it’s taken me 9 hours to get a project that I got working in 20 minutes on a normal arduino, still NOT working on the Electron.

I find the particle platform over-designed; or at least, with far too many dependencies.

The download-binary-from-web-UI and then

particle install --usb firmware.bin

takes too long.

Furthermore, as I understand it, the only way to actually compile anything locally is to use a docker instance. I tried, but it’s not working.

Or, other links seem to indicate something like this should work :

electron compile myApp.ino

but then that errors, so I look at the documentation, which tells me to check out the quickstart

which bafflingly is a node project, no .ino file.

Am I missing something ? Are others able to actually compile locally and for the Electron ?

Can someone edit, compile, and update in 1-2 seconds (like an arduino) vs 10-20 sec like on this platform ?

Or is fast compilation and iteration impossible on this platform?

I'd say, yes you are missing something :wink:
The Electron has some "OS" like system preinstalled, which standard Arduinos don't have (apart from the bootloader present on both).

What Arduino did you get communicating with a cloud via GSM in 20 minutes?
And I'd suppose in these 20 minutes you didn't include setting up your dev environment for the first time, but that's part of the 9 hours for the Electron, isn't it?

But this aside.
Once you've got CLI installed and your project setup properly you can have quick dev cycles (btw: what Arduino project does actually really take 1-2 sec for edit, compile, update?)

Your CLI commands are rather unknown to me

particle install --usb firmware.bin
electron compile myApp.ino

I'd rather think you mean

particle compile electron myApp.ino firmware.bin
particle flash --usb firmware.bin

see more options here

And if you put this into a batch like this (for Windows, device recognized as COM3)

REM enter DFU mode
mode COM3 BAUD=14400
REM remove old binary
del *.bin
REM build project in current directory . for Electronn and save as firmware.bin
cmd /c "particle compile electron . --saveTo firmware.bin"
REM flash just build binary to device via DFU USB
cmd /c "particle flash --usb firmware.bin"

You'll be not that far off your desired dev cycle speed.

After having said this, could we be of assistance to get your project working?
Or are you happy with just having let steam off and getting things done alone again?

BTW: There is also another way for local building - not only the (alpha stage) docker instance.
It's commonly refered to as local toolchain in this forum, if you want to search for it.
But I'm building 99% via the cloud build farm, only when tweaking the "OS" or framework or testing features in development, I use the local toolchain.

1 Like

re: 20 min Arduino - Skywire shield / UART. Yes, leveraging past Arduino experience. I had not realized how much of a ‘platform’ electron is, rather than just hardware. My application is a very basic PIR logger, and yes it’s taken longer to get it to work on the Electron than expected. So it goes. There’s obviously a lot of thought & work put into the platform.
Once I get iterating quickly, frustration will abate.
Thanks for thorough answer !
Look forward to trying this out, hope this helps others meanwhile.

1 Like

Thought you might like some encouragement from someone who started on Arduino and switched to Photon and Electron. The WEB IDE is a snap to use. I switched to the DEV IDE because ATOM is a much better editor plus includes a serial window and windows for published variables and functions. Yes, it took me a while to follow all the steps to get node and cli working but I just followed the guide clicking on the hot links. I only compile using the CLI when I get the dreaded no errors but no binary error message (usually a mismatch between function declaration and actual function). The CLI compile gives more complete error list (all of this is in Support dialog). My compiles and flashes are practically instantaneous although the non-OTA flash requires copying the bin file name to the cmd window. I see Scruffr describing a batch file that may help here. I my biggest headache was understanding how to get the serial driver working for WIN10. You are correct in the Particle devices are a level or two more complex than Arduino but they offer more I believe, for example, the dashboard and later organization essential services.

Thanks for the batch idea. its going to save me a ton of time and typing. I forgot about them. Haven’t knowingly used batch for 30 years.
This is probably a breach of etiquette jumping to another topic; but I’m desperate and will take up your offer to help. Please see my IFTTT published functions not available (GENERAL). The key clues here is that they showed up just fine with same code by deactivating my IFTTT account and then creating a new account… I only have one email so there is no confusion here. it’s not the functions but the device that shows up dim in the device selection wheel (is that the right term?) so that I can’t get to the functions. IFTTT knows the device is good because all my events triggers are working great. My next attempt for a cure will a stab in the dark remove my deep sleep overnight. I get a success code on publishing my four functions in setup(). Finally, the functions don’t show up in DEV published functions pane as they normally do. don’t know why I lose access. Here toda;y gone the next day.

I copied your batch file and pasted it in a batch.bat in project folder. It compiles and tries to DFU but the bin file created has the number string in name. so no go.
I tried copy *.bin to firmware.bin but get a tiny file??? How do I get compile to generate firmware.bin. I could try ? wildcard but there must be better way.

That’s odd, it used to work for me, but maybe the --saveTo switch was made compulsory now

Try this then

REM enter DFU mode
mode COM3 BAUD=14400
REM remove old binary
del *.bin
REM build project in current directory . for Electronn and save as firmware.bin
cmd /c "particle compile electron . --saveTo firmware.bin"
REM flash just build binary to device via DFU USB
cmd /c "particle flash --usb firmware.bin"

(Updated original post too)

Thanks worked great. FYI it display a line saying that in future a DFU signature would be required? Way beyond me. Hope you’ll advise in time.

This message is ignorable and some time in the future a valid signature should be added by the build farm anyway.

just wanted to say thanks for the feedback - the link to correct CLI helped.

it seems there are node-js version inconsistencies - i’m still getting them even after removing and installing everything.

I have noted this elsewhere.

Yes this would be great to figure out on OSX.

yet maybe it’s not worthwhile; perhaps l just start on a fresh Ubuntu VM.