Python busio.UART Examples
The following are 2
code examples of busio.UART().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
busio
, or try the search function
.
Example #1
Source File: kmk_keyboard.py From kmk_firmware with GNU General Public License v3.0 | 5 votes |
def init_uart(self, pin, timeout=20): if self.is_master: return busio.UART(tx=None, rx=pin, timeout=timeout) else: return busio.UART(tx=pin, rx=None, timeout=timeout)
Example #2
Source File: uart.py From Adafruit_Blinka with MIT License | 5 votes |
def test_read_value(self): import adafruit_blinka adafruit_blinka.patch_system() # needed before adafruit_gps imports time import microcontroller.pin gc.collect() import busio gc.collect() import adafruit_gps gc.collect() # configure the last available UART (first uart often for REPL) uartId, uartTx, uartRx = microcontroller.pin.uartPorts[0] uart = busio.UART(uartTx, uartRx, baudrate=9600, timeout=3000) gps = adafruit_gps.GPS(uart) gps.send_command("PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0") gps.send_command("PMTK220,1000") def try_fix(): gps.update() return gps.has_fix await_true("GPS fix", try_fix) self.assertTrue(gps.satellites is not None) self.assertTrue(-90 <= gps.latitude < 90) self.assertTrue(-180 <= gps.longitude < 180)