This library is a Python interface to the C++ library for the Monkeyboard DAB/DAB+ FM Digital Radio Board
The library is made of two parts: an unpythonic-style interface, that is a basic wrapper around the C++ library, and a more pythonisque OOP interface.
Please note This library requires the latest libkeystonecomm.so file, which has correctly exported library functions. If you haven't downloaded the library recently, so and do it now
- Download and Install the libkeystonecomm.so as per these instructions
- Download this library
git clone [email protected]:madpilot/keystonepy.git
- Run
sudo python setup.py install
from keystone.radio import Radio
with radio.Radio("/dev/ttyACM0") as r:
# Select the fourth program from the ensemble
program = r.programs[4]
# Set the volume to 6 (Max is 16)
r.volume = 6
# Request stereo sound
r.stereo = True
# Play the selected program
program.play()
# Print the name of the program
print "Now playing: " + program.name
# Wait for text from the program
while True:
if r.status != -1:
text = program.text
if text != None:
print text
It's ugly, but it's here:
http://htmlpreview.github.io/?https://github.com/madpilot/keystonepy/blob/master/docs/radio.html
http://htmlpreview.github.io/?https://github.com/madpilot/keystonepy/blob/master/docs/program.html
- I've only tested this on Linux, as I don't have access to a Windows machine with Python on it at the moment. It should work on Windows, and if it doesn't, it should be a minor fix. If you are a Windows user and know Python, feel free to fork and fix.
- Not all of the methods have been tested fully. I'm working on this. Again, if you feel adventurous fork, test and patch away.
- This is literally the second piece of Python I've ever written. If I've done something wrong, let me know.
- Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
- Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
- Fork the project.
- Start a feature/bugfix branch.
- Commit and push until you are happy with your contribution.
- Please try not to mess with the VERSION file. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Copyright (c) 2013 MadPilot Productions. See LICENSE.txt for further details.