The float needs to be able to do the following tasks
- Complete profiles on command (control motor driver)
- Measure depth of the bottom of the float accurately
- Communicate depth/time back to surface station after each profile
- Communicate information about the team and the current UTC time to surface
There is an indicator LED on the Adafruit Py QT. This chart shows what each behavior means.
|Hall effect timeout
Libraries Being Used
This is being used for communication between the float and the surface station. I did some surface level auditing of this library and it is very well written.
The surface station is using the Python WebSockets library to communicate.
This is the default WiFi library, it is a dependency of ArudinoWebsockets. It is unfortunately no longer maintained, and with enough time we will hopefully be able to move away from it.
This is a library to control Neopixel LEDs. The indicator LED on the Adafruit Py QT board we are using is a Neopixel, allowing us to set different colors for the LED.
This function takes the depth from the depth sensor and mutates a global array at the next index with the current depth.
This ISR is triggered every 5 seconds.
This function writes the
ENABLE pin to
LOW and sets a global flag saying the hall effect sensor has been triggered.
This stops the motor from running immediately, and allows other code doing a vertical profile know when it is time to switch directions.
Structure of Code
At the top of the file preprocessing directives are global variables are declared.
The functions are written in a chronological order, with ISR functions are put in the beginning of the file because those can happen at any time.