As we saw in the hardware architecture for this project, we are going to be using a serial port on the MicroPython device to send a stream of known data to the visualizer to plot. Once we've tested and debugged both sets of code, we can update our MicroPython device to send real sensor data. For now, we just need to send known values that we can use for testing:
- Before we do anything, we need to make sure that we import the Universal Asynchronous Receiver/Transmitter (UART) module from pyb and set the emergency exception buffer size. Just like we did in previous projects, this can be done using the following code:
import micropython # For emergency exception bufferfrom pyb import UART# Buffer ...