Programming language used

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.

2 Likes

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++.

1 Like

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"

1 Like

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.

1 Like

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.

1 Like

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.

2 Likes

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.

Also, where could i find some good tutorials for my photon? I tried doing the servo gong but i didnt have a maker kit and the do button app no longer existed