Last active
February 2, 2016 16:17
-
-
Save thisMagpie/d1ede52973884a0b7364 to your computer and use it in GitHub Desktop.
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
from webiopi.devices.analog import MCP3208 | |
import pylab | |
import numpy as np | |
import datetime | |
ADC0 = MCP3208(chip = 0) | |
time = datetime.datetime.now().microsecond | |
print("Time: {0}").format(time) | |
print("Analog Channel Count {0}").format(ADC0.analogCount()) | |
print("Analog Bit Resolution {0}").format(ADC0.analogResolution()) | |
print("Analog Maximum {0}").format(ADC0.analogMaximum()) | |
print("Analog Reference Voltage {0}").format(ADC0.analogReference()) | |
x = [0.0]*100 | |
y = [0.0]*100 | |
for i in range(len(x)): | |
y[i] = ADC0.analogRead(3) | |
x[i] = datetime.datetime.now().microsecond - time | |
pylab.plot(x, y) | |
pylab.xlabel('Time in micro seconds') | |
pylab.ylabel('Bit Resolution') | |
pylab.title('Bit Resolution vs Time in micro seconds.') | |
pylab.grid(True) | |
pylab.savefig("sample_3_5.pdf") | |
pylab.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment