You can
Cant i just install a JS interpreter on to a photon? Also, how do i upload code to my photon manually? I want to use a different text editor, like Atom.
That's more and more leading away from the original topic.
But
Uploading a new binary (e.g. firmware.bin
) is easiest done via CLI
particle flash <DeviceName> firmware.bin
# or
particle flash --usb firmware.bin
# or
particle flash --serial firmware.bin
You can also use the Atom based Particle Dev to edit, build and flash OTA.
If you got one that runs on a Photon, please share.
So the language a photon runs on is c++.
It runs on ARM machine instructions (provided via binary files), but the common language to write the code which will be resulting in these binaries is C++.
It runs on Wiring, which according to Wikipedia:
"The Wiring IDE comes with a C/C++ library called âWiringâ, which makes common input/output operations much easier. Wiring programs are written in C/C++, although users only need to define two functions to make a runnable program:
setup() â a function run once at the start of a program which can be used to define initial environment settings
loop() â a function called repeatedly until the board is powered off"
So if I put a Wiring library in a folder with my sketch how do I source that file in my code?
Since you donât mention on how youâre planning on compiling, hereâs how youâd do it using the web IDE:
https://docs.particle.io/guide/getting-started/build/photon/#using-libraries
https://docs.particle.io/guide/getting-started/build/photon/#adding-files-to-your-app
How does the web IDE compile code in the first place? Then I can make a plan on how to compile my code. With JavaScript I didnt have to compile anything; I just had to source it in my HTML index.
It's a bit complex, but this is the gist of it.
I dont understand what "build farm" means. Is that a program or file? And to quote what ScruffR said earlier about CLI uploading...
what is a binary and is the firmware.bin name supposed to be changed for your project?
A âbuild farmâ is a collection of servers that builds/compiles the code.
A binary file is what the microcontroller needs to work, itâs the machine (binary) code. You can name it whatever you like, as long as you keep the extension intact and refer to it by its (new) name.
Personally I think it might be best to stick to the Web IDE for now, itâs the easiest way to get started if youâre unfamiliar with these kinds of things. Once you progress and learn a bit you can move forward using more advanced tools.
Well, I got the Particle IDE, so now I can use it in atom. I just have one more question. Is there a way to download the firmware on my photon currently to my text editor?
There is not, (un)fortunately.
As said earlier, your code will be compiled (translated) and built into binary machine code which will be uploaded to the device, so the only thing you could read back from the device is that translated code - not your original source code.
So how do I view the translated code? And isnt there a way to re-translate it back into the source code?
You could open the binary file, but unless youâre a computer, it wonât do you much good, itâs not human-readable.
And thereâs no way to go back from a binary.
Thanks!
Can I use c on a photon?
Since thatâs what C++ is based on, which is what Processing is based on, which is what Wiring is based on, Iâd go with a yes.