Tim Mikkelsen's Raspberry Pi Projects


2016/06 RPi Python LED test


This project was a test to get the process and infrastructure set up for embedded Raspberry Pi projects.  The actual test is very simple - turning off and on an LED.

My systems are Apple Mac and I wanted to be able do at least some of the development on the Mac (in PyCharm) and transfer it over to the Raspberry Pi.  

A few comments:

1. I was using a Raspberry Pi A for this which is slower and has a limited number of I/O pins (on a 26 pin header).

2. To be able to transfer the Python code, I had to install and configure some software on the Raspberry Pi OS (netatalk and afpd.service instructions from RDC5).

3. The tools on the Raspberry Pi are IDLE and Python 2.7.


- NOOB software for the Raspberry Pi

- netatalk for the Raspberry Pi

- afpd.service for the Raspberry Pi

- IDLE on the Raspberry Pi

- Python 2.7

- PyCharm for the Mac


- Raspberry Pi

- 330 ohm resistor


Mac access to the RPi:

1. On Pi: run the commands:

sudo apt-get install netatalk

sudo apt-get install avahi-daemon

sudo update-rc.d avahi-daemon defaults

2. On Pi: create file /etc/avahi/services/afpd.service:

sudo nano /etc/avahi/services/afpd.service

3. On Pi: In nano add this content:

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->

<!DOCTYPE service-group SYSTEM "avahi-service.dtd">


   <name replace-wildcards="yes">%h</name>






4. On Pi: Exit nano, saving the file.

5. On Pi: Run this command:

sudo /etc/init.d/avahi-daemon restart

6. You should now be able to see the Pi in the Finder sidebar. code:

import RPi.GPIO as GPIO

import time




print "LED on"



print "LED off"