7

I'm relatively new to the Pi from a webdev and basic Python background. What I'm finding ridiculously annoying is trying to debug and run code efficiently on the Pi. I like to develop on Sublime2 or something similar, but I can't do this without continuous SSH connections breaking/reconnecting and spending ages just trying to run the changes I've made.

So what does everyone use here? What am I missing? Do you all write the code directly on the Pi!? There must be an efficient way of trying my sensors out etc?

Can anyone help?

7

Do you all write the code directly on the Pi!?

No.

Probably the simple strategy is to mount a share/directory/filesystem from the pi onto whatever computer you want, edit the code this way remotely using whatever software you want, and then to test just use a single, ongoing ssh session.

This should not introduce some lag if you are on the same (WLAN). If so, you could do it the other way around (share from your local system to the pi). Sharing from the pi, however, has the advantage that you can then do it from more than one system (although a VCS such as git can solve that problem).

There are piles of ways to do this each with various advantages and disadvantages; a few of the more common ones are:

  • Thanks. What method do you use personally out of interest? Or if you were to suggest I used one of the above, which would it be? – john Sep 14 '15 at 21:29
  • 2
    I like sshfs, but I use linux at both ends, in which case it is pretty simple (you just have to configure sshd on the pi, and read the sshfs man page -- I'm sure there are also many explanations online). I think windows/OSX users generally prefer samba. – goldilocks Sep 14 '15 at 21:34
  • 1
    @john I have used both number 1 and 2 FWIW, I would also add that a good SSH tool (super putty/pageant)setup with certificates instead of username/password makes for a smoother experience too. – Steve Robillard Sep 14 '15 at 21:36
  • This forum post raspberrypi.org/forums/viewtopic.php?f=66&t=83991 seems to indicate that multiple people have gotten PyCharm working directly on the Pi 2. – nu everest Jan 17 '16 at 15:38
  • @nueverest Sure, but the question is about working remotely. While you can get any number of different editors installed locally, many/most people will not want to work directly on the Pi when they can use their desktop or laptop instead. – goldilocks Jan 17 '16 at 15:41
3

I tend to develop code on a laptop but have one or two open SSH sessions to the Pi. I keep the code on the laptops hard drive. The code directory is exported as /code via NFS to the Pi.

The cycle is usually edit, save, cross-compile on top right window, download to the Pi, run in the bottom right window. Or if it's a scripting language like Python or bash then just run in the bottom right window.

workflow

1

I have an option:

Turn your Raspberry Pi into a Git server and push all your changes to the Pi so it will have the latest version of your project. Then test on the Pi instead of using SSH.

  • 1
    How do I setup the RPi as a Git server? – user67191 Jul 16 '17 at 10:16
1

I use PuTTY to SSH directly to the pi for simple programs. I also transfer larger code via FileZilla and ftp into the pi. I write the code using notepad, it's simple and just works good enough for python. The nano editor highlights better and writing directly on the pi has the other advantage of being able to test GPIO code immediately.

1

I use VNC to use a remote desktop. I code on my laptop, FTP using Filezilla, then test off the Raspberry Pi. This is extremely useful, as I can test on the Pi without being at home. (RealVNC cloud connection)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.