silver2row

MCP3008

Nov 10th, 2019
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. from LDRIII import MCP3008
  2. import time
  3.  
  4. adc = MCP3008()
  5.  
  6. try:
  7.     while True:
  8.         #Channel = 0
  9.         Vref = 3.3
  10.         Voltage = (Vref / adc.read(channel = 0))
  11.         print("The Reading:\t", (adc.read(channel = 0)))
  12.         print("Voltage:\t", Voltage)
  13.         time.sleep(4)
  14.  
  15. except:
  16.     print("Turning off the source!")
  17.     pass
Add Comment
Please, Sign In to add comment