I have used the Arduino IDE very successfully and am very happy with how it works. But …
With the Raspberry Pi I create a few ssh sessions and write code with nano. This doesn’t seem the most productive to me, but it does work. I understand the vast differences between loading code into an ATMega328P and running Python script on a Linux computer.
I have also looked at the Raspberry Pi GUI development interface. The limitation is the need for a screen, keyboard and mouse. Also, the Pi can be very slow when using multiple windows to research a project.
For those who develop Python script for the Raspberry Pi, I would like to know if there is a better way.
When I’m working on a Python script for the Raspberry Pi, which I have been doing a lot of lately, I use both a PC and a Pi side by side. I look up any reference on the computer, and have the pi setup with a keyboard/mouse/display and a write my code on there using an editor. Browsing the web is pretty demanding on the Pi and will slow you down a bit.
I thought the side by side would be the way to go.
Unfortunately my work space is split. Another screen keyboard and mouse will not fit on my PC desk.
But, I recently set up an old PC in the workshop, that might become my development area.
If you are looking for more of a power-user setup, then download Atom Editor (it’s free, and a great editor to get familiar with). It has syntax highlighting, collapsable code, lots of plugins, designed exactly for this type of stuff.
Install the Atom package for FTP-Remote, then explore the readme for guides.
The TL;DR, press CTRL+Space to open the FTP server manager, configure your master password, then add your SFTP settings for your Pi. An example:
Then you can “twist” the arrow down to open a connection and explore the entire RPi. From there, it’s native editing of files (double click to open, save will update the file directly on the RPi).
You can have a separate SSH terminal open on the same computer, to run scripts etc.
- Enable SSH on your Raspberry Pi
- Download Atom onto your PC
- From within Atom, download the FTP-Remote plugin
- Use a static IP address for your Raspberry Pi (or a custom hostname for your RPi)
- Change your RPi root password when you enable SSH
- If any doubt whatsoever, do not edit files without backing them up first. Especially system files.
Thanks Graham, I’ll check it out.
I code on my Linux box. Thonny is fine for this sort of stuff. I use FileZilla to copy the Python script to the Raspberry Pi and ssh to connect and restart services that run the scripts. I have 7 Pi units and use the same code on some of them.
I’m not going back to using any variant of an Arduino as code updates for an infield unit fully wired is impractical.
You could also try using rmate with VSCode - https://medium.com/@yuchenglin/remote-files-editing-on-raspberry-pi-using-vs-code-daf78fe51e84 rmate lets you remotely edit code on your Pi using VSCode (I think it can be used with other editors too) on your PC.
VS Code will be around a lot longer than Atom will, given Microsoft now owns both. Good advice there arb!