Sunday, August 31, 2014

Raspberry Pi - Python Libraries - Raspbian or Adafruit

Windows 7
Linux 3.1.9adafruit+ armv6l
PuTTY 0.63
WinSCP 5.5.5


Status:
  • 20140830 Working both examples.
ToDo:
  • Choose the " best"  Python API:
    • RPIO?
    • Arduino Nampy? - This library allows you to communicate with your Arduino connected via USB using classes and methods really similar to those in the Arduino framework. Behind the scenes , Nanpy communicates via USB with the server part running as Arduino firmware. 
    • WiringPi?
  • OR use Serial Communication and pass commands to Arduino connected.
Install RPIO lib:
  • cd ~/
  • sudo apt-get install python-setuptools
  • sudo easy_install -U RPIO
  • git clone https://github.com/metachris/RPIO.git
  • cd RPIO
  • sudo python setup.py install
Testing RPIO lib:
  • cd ~/RPIO/examples
  • PWM Servo example:
  • python example3_pwm_servo.py

  • PWM LowLevel example:
  • python example4_pwm_lowlevel.py



Connect Raspberry Pi and Arduino:




  • sudo apt-get install python-serial
  • Call Python console:
  • python
  • >>>import serial
  • >>>ser = serial.Serial('/dev/ttyACM0', 500000)
  • >>>ser.readline()
  • >>>print ser
  • >>>ser.write('3')

Install Arduino lib:

  • sudo apt-get install arduino (see links 4 and 5 below)
References: