Add first lines of code to send json data to raspberry pi with additionnal UART

This commit is contained in:
Pierrick C 2018-08-03 22:44:01 +02:00
parent 588a0e815c
commit a5a279a64d
1 changed files with 8 additions and 1 deletions

View File

@ -34,6 +34,7 @@ __version__ = 0.1
# config #
##########
print_data = True
send_json_data = True
backup_data = True
data_to_neopixel = True
gps_enable = True
@ -262,6 +263,11 @@ if gps_enable:
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') # 1000 ms refresh rate
# second UART to communicate with raspberry pi GPIO
if send_json_data:
rpi_uart = UART(microcontroller.pin.PB10, microcontroller.pin.PB11,
baudrate=115200, timeout=2000)
# Integrated Neopixel
if data_to_neopixel:
pixel = neopixel.NeoPixel(microcontroller.pin.PA06, 1, brightness=1)
@ -292,7 +298,8 @@ while True:
data.update()
if print_data:
data.show()
print(data.json())
if send_json_data:
rpi_uart.write(data.json())
if backup_data:
data.write_on_flash()
if data_to_neopixel: