Created
May 15, 2012 02:12
-
-
Save omundy/2698550 to your computer and use it in GitHub Desktop.
Simplified analog input test file for PyBBIO
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# analog_test_simple.py by Owen Mundy | |
# modified from: | |
# analog_test.py - Alexander Hiam | |
# Testing analogRead() | |
# | |
# *** NOTICE *** | |
# The maximum ADC input voltage is 1.8v, | |
# applying greater voltages will likely cause | |
# permanent damage to the ADC module! | |
# | |
# This example is in the public domain | |
# Import PyBBIO library: https://github.com/alexanderhiam/PyBBIO | |
from bbio import * | |
t = 100 | |
# Create a setup function: | |
def setup(): pass # Nothing to do here | |
# Create a main function: | |
def loop(): | |
print "-----" | |
print "AIN0 [P9.39] - " + str(analogRead(A0)) | |
delay(t) | |
print "AIN1 [P9.40] - " + str(analogRead(A1)) | |
delay(t) | |
print "AIN2 [P9.37] - " + str(analogRead(A2)) | |
delay(t) | |
print "AIN3 [P9.38] - " + str(analogRead(A3)) | |
delay(t) | |
print "AIN4 [P9.35] - " + str(analogRead(A4)) | |
delay(t) | |
print "AIN5 [P9.36] - " + str(analogRead(A5)) | |
delay(t) | |
print "AIN6 [P9.33] - " + str(analogRead(A6)) | |
delay(t) | |
print "AIN7 [P9.39] - " + str(analogRead(A7)) | |
delay(t) | |
delay(500) | |
# Start the loop: | |
run(setup, loop) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works great from command line, how can I get PyBBIO to work within the apache2 webspace?