Add first lines of code to send json data to raspberry pi with additionnal UART
This commit is contained in:
parent
588a0e815c
commit
a5a279a64d
@ -34,6 +34,7 @@ __version__ = 0.1
|
|||||||
# config #
|
# config #
|
||||||
##########
|
##########
|
||||||
print_data = True
|
print_data = True
|
||||||
|
send_json_data = True
|
||||||
backup_data = True
|
backup_data = True
|
||||||
data_to_neopixel = True
|
data_to_neopixel = True
|
||||||
gps_enable = 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('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
|
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
|
# Integrated Neopixel
|
||||||
if data_to_neopixel:
|
if data_to_neopixel:
|
||||||
pixel = neopixel.NeoPixel(microcontroller.pin.PA06, 1, brightness=1)
|
pixel = neopixel.NeoPixel(microcontroller.pin.PA06, 1, brightness=1)
|
||||||
@ -292,7 +298,8 @@ while True:
|
|||||||
data.update()
|
data.update()
|
||||||
if print_data:
|
if print_data:
|
||||||
data.show()
|
data.show()
|
||||||
print(data.json())
|
if send_json_data:
|
||||||
|
rpi_uart.write(data.json())
|
||||||
if backup_data:
|
if backup_data:
|
||||||
data.write_on_flash()
|
data.write_on_flash()
|
||||||
if data_to_neopixel:
|
if data_to_neopixel:
|
||||||
|
Loading…
Reference in New Issue
Block a user