Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPS Test Code #85

Open
JayChen35 opened this issue Feb 6, 2020 · 0 comments
Open

EPS Test Code #85

JayChen35 opened this issue Feb 6, 2020 · 0 comments

Comments

@JayChen35
Copy link
Contributor

from smbus2 import SMBusWrapper
import time

EPS_ADDRESS = 0x2b
with SMBusWrapper(1) as bus:
    bus.write_i2c_block_data(EPS_ADDRESS, 0x41, [0x00])
    time.sleep(0.5)
    print("on")
    while True:
        # write_cmd = EPS_ADDRESS << 1
        # EPS_ADDRESS = b"0x2b"
        #		bus.write_i2c_block_data(EPS_ADDRESS, 0x10, [0xE440])
        bus.write_i2c_block_data(EPS_ADDRESS, 0x10, [0xE4])
        bus.write_i2c_block_data(EPS_ADDRESS, 0x10, [0x44])
        # time.sleep(0.5)

        # Anything explicit (addresses like 0x10) should be in an enum

        # bus.write_i2c_block_data(EPS_ADDRESS, 0x11, [0x30])
        time.sleep(0.5)
        srikar = bus.read_i2c_block_data(EPS_ADDRESS, 0x10, 2)
        print(srikar)
        print((srikar[0] * 256 + srikar[1]) * .00893)
        time.sleep(0.5)
        # bus.write_byte(EPS_ADDRESS, EPS_ADDRESS)
        # time.sleep(0.5)
        # bus.write_byte(EPS_ADDRESS, 0x40)
        # time.sleep(0.5)
        # bus.write_byte(EPS_ADDRESS, 0x00)
        # print("All PDMs on.")
        # time.sleep(3)
        ########################################
        # bus.write_byte(EPS_ADDRESS, write_cmd)
        # time.sleep(0.5)
        # bus.write_byte(EPS_ADDRESS, 0x40)
        # time.sleep(0.5)
        # bus.write_byte(EPS_ADDRESS, 0x00)
        # print("All PDMs off.")
        # time.sleep(0.5)
        break
print("Done.")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants