Changes
This commit is contained in:
17
testprograms/weighttest
Executable file
17
testprograms/weighttest
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import spidev
|
||||
import time
|
||||
import os
|
||||
|
||||
spi = spidev.SpiDev()
|
||||
spi.open(0, 0)
|
||||
|
||||
def readchannel(channel):
|
||||
adc = spi.xfer2([1, (8+channel)<<4, 0])
|
||||
data = ((adc[1]&3)<<8) + adc[2]
|
||||
return data
|
||||
|
||||
while True:
|
||||
print(readchannel(7))
|
||||
time.sleep(.5)
|
||||
Reference in New Issue
Block a user