Beaglebone black: Difference between revisions

From Federal Burro of Information
Jump to navigationJump to search
No edit summary
No edit summary
Line 5: Line 5:
;sensors:
;sensors:
:http://yetticave.blogspot.ca/2013/06/beaglebone-18v-analog-logic.html
:http://yetticave.blogspot.ca/2013/06/beaglebone-18v-analog-logic.html
<code>
#! usr/bin/python
import time
def sig_cel(sig):
return (sig-500)/10
def cel_far(cel):
return (cel*9.0/5.0) +32
try:
while True:
sig = file('/sys/devices/ocp.2/helper.14/AIN1','r').read()
mV = int(sig)
C_Temp = sig_cel(mV)
F_Temp = cel_far(C_Temp)
print 'Millivolts: %d Celsius: %.2f Farenheit: %.2f' % (mV,C_Temp,F_Temp)
time.sleep(1)
except KeyboardInterrupt:
    sig.close()
</code>

Revision as of 02:47, 16 February 2014

GPIO and overlays
http://derekmolloy.ie/gpios-on-the-beaglebone-black-using-device-tree-overlays/
sensors
http://yetticave.blogspot.ca/2013/06/beaglebone-18v-analog-logic.html

  1. ! usr/bin/python

import time

def sig_cel(sig): return (sig-500)/10

def cel_far(cel): return (cel*9.0/5.0) +32

try: while True: sig = file('/sys/devices/ocp.2/helper.14/AIN1','r').read() mV = int(sig) C_Temp = sig_cel(mV) F_Temp = cel_far(C_Temp) print 'Millivolts: %d Celsius: %.2f Farenheit: %.2f' % (mV,C_Temp,F_Temp) time.sleep(1)

except KeyboardInterrupt:

   sig.close()