# mx05v05.py MX05V, FS1000S 433MHz Demo Program v0.5 tlfong01 2021oct24hkt2143 # Pico GP Pin Assignment # GP0 = UART0 TxD = MX05 433MHz Revciver Module Data Pin # GP1 = UART0 RxD = FS1000D 433MHz Transmit Module Data Pin # Setup # To loop back, short TxD pin to RxD pin from machine import UART, Pin import utime uart0 = UART(0, baudrate = 9600, tx=Pin(0), rx=Pin(1)) def testUartLoopBackV01(): print('Begin testUartLoopBackV01(), ...') testMsg = 'Hello World' print(' writeTestMsg =', testMsg) uart0.write(testMsg) # write 5 bytes utime.sleep(0.5) bytesRead = uart0.read(20) # read up to 5 bytes print(' bytes read =', bytesRead) print('End testUartLoopBackV01().') return def testUartLoopBackV02(): print('Begin testUartLoopBackV02(), ...') #testMsg = 'Hello World' testBytes = b'\0x5b\0xb5' print(' bytes written =', testBytes) uart0.write(testBytes) utime.sleep(0.5) bytesRead = uart0.read(20) # print(' bytes read =', bytesRead) print(' Begin repeat printing bytes =', testBytes) for count in range(100000): uart0.write(testBytes) utime.sleep(0.01) print(' End repeat printing bytes =', testBytes) print('End testUartLoopBackV02().') return # *** Main *** #testUartLoopBackV01() testUartLoopBackV02() # .END ''' *** Sample output *** MicroPython v1.16 on 2021-06-18; Raspberry Pi Pico with RP2040 Type "help()" for more information. >>> %Run -c $EDITOR_CONTENT Begin testUartLoopBackV02(), ... bytes written = b'\x00x5b\x00xb5' bytes read = None Begin repeat printing bytes = b'\x00x5b\x00xb5' End repeat printing bytes = b'\x00x5b\x00xb5' End testUartLoopBackV02(). >>> '''