from RPLCD.i2c import CharLCD
from gpiozero import Button
from time import sleep
from smbus2 import SMBus

class ADS7830:
    def __init__(self, address=0x4b, bus=1):
        self.bus = SMBus(bus)
        self.address = address

    def read(self, channel):
        # channel = 0-7
        command = 0x84 | (channel << 4) | ((channel & 0x04) >> 2)
        self.bus.write_byte(self.address, command)
        return self.bus.read_byte(self.address)