def test_slave():
    # for my hardware. Delete these three lines for normal h/w
    from micropower import PowerController
    power_controller = PowerController(pin_active_high='Y12',
                                       pin_active_low='Y11')
    power_controller.power_up()

    s = rp.Slave(config_slave)
    obj = [0, '']  # This is the object to be sent
    x = ord('a')
    while True:
        try:
            result = s.exchange(obj)
        except rp.NoData:
            pass  # Master has sent no data. Try again.
        except OSError:  # Optionally trap timeout errors (e.g. out of range)
            print("Timeout")
        else:
            print(result)  # Print the received object
            if result[0] != len(result[1]):
                print('Error')
                break
            obj[1] = obj[1] + chr(x) if len(
                obj[1]) < 70 else ''  # Keep from getting too huge
            x = x + 1 if x < ord('z') else ord('a')
            obj[0] = len(obj[1])
Exemple #2
0
def ts():
    from micropower import PowerController
    power_controller = PowerController(pin_active_high='Y12',
                                       pin_active_low='Y11')
    power_controller.power_up()
    s = rf.Slave(v1_config)
    send_msg = ToMaster()
    while True:
        result = s.exchange(send_msg)  # Wait for master
        if result is not None:
            print(result.i0)
        else:
            print('Timeout')
        send_msg.i0 += 1
def ts():
    from micropower import PowerController

    power_controller = PowerController(pin_active_high="Y12", pin_active_low="Y11")
    power_controller.power_up()
    s = rf.Slave(v1_config)
    send_msg = ToMaster()
    while True:
        result = s.exchange(send_msg)  # Wait for master
        if result is not None:
            print(result.i0)
        else:
            print("Timeout")
        send_msg.i0 += 1
Exemple #4
0
def ts():                                       # Test slave: runs on V1 board
    from micropower import PowerController
    power_controller = PowerController(pin_active_high = 'Y12', pin_active_low = 'Y11')
    power_controller.power_up()
    s = rp.Slave(config_slave)
    obj = [0, '']
    x = ord('a')
    while True:
        try:
            result = s.exchange(obj)
        except rp.NoData:                          # Master has sent nothing
            pass
        except OSError:
            print("Timeout")
        else:
            print(result)
            obj[0] += 1
            obj[1] += chr(x)
            x = x +1 if x < ord('z') else ord('a')
            if len(obj[1]) > 12:
                obj[1] = ''         # Fit in LCD
def ts():  # Test slave: runs on V1 board
    from micropower import PowerController
    power_controller = PowerController(pin_active_high='Y12',
                                       pin_active_low='Y11')
    power_controller.power_up()
    s = rp.Slave(config_slave)
    obj = [0, '']
    x = ord('a')
    while True:
        try:
            result = s.exchange(obj)
        except rp.NoData:  # Master has sent nothing
            pass
        except OSError:
            print("Timeout")
        else:
            print(result)
            obj[0] += 1
            obj[1] += chr(x)
            x = x + 1 if x < ord('z') else ord('a')
            if len(obj[1]) > 12:
                obj[1] = ''  # Fit in LCD
Exemple #6
0
def test_slave():
    # for my hardware. Delete these three lines for normal h/w
    from micropower import PowerController
    power_controller = PowerController(pin_active_high = 'Y12', pin_active_low = 'Y11')
    power_controller.power_up()

    s = rp.Slave(config_slave)
    obj = [0, ''] # This is the object to be sent
    x = ord('a')
    while True:
        try:
            result = s.exchange(obj)
        except rp.NoData:
            pass # Master has sent no data. Try again.
        except OSError: # Optionally trap timeout errors (e.g. out of range)
            print("Timeout")
        else:
            print(result) # Print the received object
            if result[0] != len(result[1]):
                print('Error')
                break
            obj[1] = obj[1] + chr(x) if len(obj[1]) < 70 else '' # Keep from getting too huge
            x = x +1 if x < ord('z') else ord('a')
            obj[0] = len(obj[1])
Exemple #7
0
import pyb, epaper
from micropower import PowerController
p = PowerController(pin_active_high = 'Y12', pin_active_low = 'Y11')
p.power_up()
a = epaper.Display(side = 'L')

with a.font('/sd/Courier_New19x11$isDegs', monospaced = True):
    a.puts('Test of alignment 12.34\n')
    a.puts('mmmmmmmmmmmmmmmmm 12.34\n')
a.show()
p.power_down()