Tuesday 19 February 2013

Python, Raspberry Pi and Raspbian (Debian)

I've been doing a lot of development with Python on the Raspberry Pi's, and I just wanted to share a few thoughts from the middle of my project.

Coding Application
When I first started coding I was using nano of the Raspberry Pi, however I have now moved my development on to my Windows based PC. The best light-weight coding application that I have found for Python has been Notepad++. There are many alternatives out there, but I find this works well for all of the different languages that I code in.

IDLE (the real-time editor for Python) I didn't really get on with, and prefer editing the code and then running it afterwards.

Indentation
When starting to work with Python, I was constantly getting thrown by the indentation and lack of semi colons at the end of each line. It's something I came more accustomed with having spent more time coding.

Now, I'm a big fan of the way it works and I prefer it. It forces people to be neat coders and that's something that i'm all for.

GPIOs
I got a Raspberry Pi when they first were released and getting the GPIOs to work were easy enough, but no-where near as easy as it is now.

If anyne has a Raspberry Pi and hasn't yet had a chance to work with the GPIOs I would strongly recommend it. For the main project I am working on, i'm using some ADC cobbler code from adafruit which in turn pulls data from an 8 channel ADC chip. This is mounted on a separate power board which powers our unit.

On a side note, did you know you can power the Raspberry Pi by apply a voltage the 5v pin on the GPIO? A word of warning, if you do this you bypass the built in liquid fuse which protects the board - so be sure to incorporate a replacement into your power board design.

Terminal/Linux Commands
The other great thing I like about Python is being able to pass commands through to the local console of the operating system.

Import os
os.system("something here") 

This allows the command to be sent through to the local terminal - allowing greater control over the system. You can pass reboot commands, turn lan devices on and off - all sorts.

Mix this with a local light SQL server and you can do some pretty impressive things!

Closing Words
That's all i've got to say today, since my last post other projects have risen to the top of my list so i'll be carrying on with the mesh system soon and trying to get DHCP working. 

I had a play with the v3 Google API for it's map system last night and may do a quick write up on here. It's part of this project too, allowing me to plot locations of my Raspberry Pi units on a map of a given area. More about this later!

No comments:

Post a Comment