Page 1 of 1

python-rpi.gpio off raspberry pi

Posted: Sun Oct 20, 2013 12:24 am
by Ecurb
Hello,

I've ran into a small problem in that I can't seem to import GPIO on my regular computer, it give me a message of some sort that it can only be ran on a raspberry pi. Of course I'd like to write the code on my regular PC and the send it over to the RP, so how is this normally done?

thanks,
Bruce

Re: python-rpi.gpio off raspberry pi

Posted: Sun Oct 20, 2013 2:44 am
by TheWalkingCactus
Firstly, why do you want to program it on your main computer? And how would you simply 'send it over?' I think it's much easier to just program right on the Pi, to greatly simplify debuging.

How I do it (not sure if this is 'normal' so to speak) is to log in as Root and then just write it in Idle. If you've never used the Root user before, see here: http://elinux.org/R-Pi_Troubleshooting# ... t_password

Then
- Either SSH & VNC into the Pi, or use a screen and keyboard.
- Log in as Root and enter the password
- Click the 'menu' button on the bottom left
- Select `Run`
- Type

Code: Select all

sudo Idle
- Program as usual


The only reason you can't just do it in the normal user is that the GPIO stuff needs root access, but doing what I describes work perfectly.

Re: python-rpi.gpio off raspberry pi

Posted: Sun Oct 20, 2013 5:51 am
by Hove
You can write the code with a code editor anywhere you wish. However, only the Raspberry Pi has the GPIO hardware to match the RPi.GPIO library you are importing into your Python code. Therefore you need to transfer your code from where you wrote it to where you need it - you could copy it to USB drive, FTP it across, post it somewhere on the web and then copy it back (dropbox).

Lots of options

Re: python-rpi.gpio off raspberry pi

Posted: Sun Oct 20, 2013 6:07 am
by WebPi
If you share your Pi's folders on your network using samba, you can open files on your Pi on your PC.

Re: python-rpi.gpio off raspberry pi

Posted: Sun Oct 20, 2013 9:31 am
by Ecurb
Hi all,

Thanks for the ideas. Basically what I have is a RP sitting without a keyboard or monitor, so right now I use putty to SSH into the machine to install/run stuff. For sending over the files I use filezilla with SSH, very easy. So let me think about it some more. I'll post back with whatever I endup doing.

Thanks,
Bruce

Re: python-rpi.gpio off raspberry pi

Posted: Sun Oct 20, 2013 3:42 pm
by Ecurb
ok I'm really happy now, I ended up using "xrdp" to remote into the desktop, here is the video that helped me
http://www.youtube.com/watch?v=Y5SHRazACBE

It's really with linux becuase I can just put that instance in another workspace and quickly switch back and fourth. And I still have the filezilla for sending files over.

Bruce

Re: python-rpi.gpio off raspberry pi

Posted: Sun Oct 20, 2013 6:37 pm
by Ecurb
Hi again,

another issue I'm running into...

I'm starting idle in the terminal like "sudo idle".

idle starts as expected but when try to run my program is says that it cant access the /dev/mem/, try running as root!
I'm totally confused because I can find a lot of information everywhere telling to start it up with sudo which I'm doing. I've even tried to feed it into the idle terminal or whatever it's call and still get the same result.

any idea?

Re: python-rpi.gpio off raspberry pi

Posted: Sun Oct 20, 2013 6:57 pm
by Ecurb
I must be on the wrong path, because I went to the file "mem" did chmod 777, which set everything to read/write and it's still won't work!

Re: python-rpi.gpio off raspberry pi

Posted: Sun Oct 20, 2013 8:30 pm
by Ecurb
small update. I have found that I can run it from terminal by doing "sudo python MYPROGRAM". Still it's not working from idle.

Re: python-rpi.gpio off raspberry pi

Posted: Sun Oct 20, 2013 8:46 pm
by Ecurb
final update. After working with it this way I think it's fine, I just work on the program in IDLE and then run it from the terminal. Thanks again folks.

Re: python-rpi.gpio off raspberry pi

Posted: Mon Oct 21, 2013 11:34 am
by texy
You could also try

Code: Select all

sudo idle
Texy