Skip to content

Instantly share code, notes, and snippets.

@omundy
Created May 15, 2012 02:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omundy/2698550 to your computer and use it in GitHub Desktop.
Save omundy/2698550 to your computer and use it in GitHub Desktop.
Simplified analog input test file for PyBBIO
# 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)
@AndrewDoherty28
Copy link

This works great from command line, how can I get PyBBIO to work within the apache2 webspace?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment