Skip to content

EPS Test Code #85

@JayChen35

Description

@JayChen35
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.")

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions