Created
April 17, 2017 13:34
-
-
Save OwenBrotherwood/fced2f140663367c13ee13374186c08f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from microbit import * | |
def RN2483_Reset(): # Reset RN2483 | |
display.show("R") | |
pin3.write_digital(1) | |
pin3.write_digital(0) | |
sleep(100) | |
pin3.write_digital(1) | |
sleep(100) | |
#RN2483_GetResponse() | |
def RN2483_SendCommand(command): | |
display.show("C") | |
uart.write(command) | |
response_string = RN2483_GetResponse() | |
return response_string | |
def RN2483_GetResponse(): | |
display.show("G") | |
response_string = "No response" | |
for i in range(100): | |
display.show(str(i)) | |
sleep(100) | |
if uart.any(): | |
display.show("U") | |
response_string = uart.readline() | |
break | |
return response_string | |
while True: | |
try: | |
uart.write("\r\nstarting\r\n") | |
display.show("S") | |
uart.init(57600,tx=pin0,rx=pin1 ) | |
RN2483_Reset() | |
response_ver = RN2483_SendCommand("sys get ver\r\n") | |
finally: | |
display.show("F") | |
uart.init(115200) | |
uart.write(response_ver) | |
uart.write("\r\nfinished\r\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment