Skip to content
Snippets Groups Projects
Commit 60103d1c authored by Quentin Bolsee's avatar Quentin Bolsee
Browse files

support for prints

parent 5381b70c
Branches
No related tags found
No related merge requests found
*.psd
examples/mpy_bridge.py
__pycache__
examples/__pycache__
.idea
\ No newline at end of file
......@@ -7,15 +7,18 @@ def get_pin_value(pin):
def echo_function(*args, **kwargs):
return f"You sent args: {args}, kwargs: {kwargs}"
return "You sent args {}, kwargs {}".format(args, kwargs)
def led_on():
print("LED ON")
p_led.off()
def led_off():
print("LED OFF")
p_led.on()
p_led = machine.Pin(16, machine.Pin.OUT)
led_off()
......@@ -4,17 +4,19 @@ import time
def main():
# open device, read functions
d = mpy_bridge.Device("COM5")
d = mpy_bridge.Device("COM39")
# print out functions
print(d)
# blink LED once
# # blink LED once
d.led_on()
time.sleep(0.2)
d.led_off()
time.sleep(0.2)
print(d.echo_function(4, 5, a=10))
if __name__ == "__main__":
main()
......@@ -5,7 +5,7 @@ import matplotlib.pyplot as plt
def main():
d = mpy_bridge.Device("COM34")
d = mpy_bridge.Device("COM39")
n_exp = 1024
results = []
......@@ -15,8 +15,8 @@ def main():
t2 = datetime.datetime.now()
results.append((t2 - t1).total_seconds())
print(np.mean(results))
print(np.std(results))
print(f"Mean RTT: {np.mean(results)}")
print(f"STD RTT: {np.std(results)}")
results_ms = [1000*x for x in results]
......
......@@ -2,10 +2,10 @@ import mpy_bridge
def main():
d = mpy_bridge.Device("COM34")
# Open device, skip reading its functions (the main file might be absent)
d = mpy_bridge.Device("COM39", init=False)
# Upload main file
d.upload("micropython/main.py", "main.py")
print(d)
d.close()
if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment