sdpArray.py 492 B

12345678910111213141516171819202122232425
  1. if __name__ == "__main__":
  2. from mcp3008 import MCP3008
  3. else:
  4. from .mcp3008 import MCP3008
  5. import time
  6. class SdpArray:
  7. def __init__(self):
  8. self.adcs = (
  9. MCP3008(0, 0),
  10. MCP3008(0, 1)
  11. )
  12. def getVoltage(self, channel):
  13. if channel < 8:
  14. return adc[0].getVoltage(channel)
  15. else:
  16. return adc[1].getVoltage(channel-8)
  17. if __name__ == "__main__":
  18. sdps = SdpArray()
  19. while True:
  20. print("Anliegende Spannung:", sdps.getVoltage(0))
  21. time.sleep(1)