remove loop from module, use channel 7

This commit is contained in:
LazyAssassin445
2017-03-04 12:51:31 +00:00
parent 731acedea7
commit ee3dfc117e
2 changed files with 1 additions and 4 deletions

14
modules/weight.py Normal file
View File

@@ -0,0 +1,14 @@
#!/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