SOFTWARE - CONTROLLER
Our controller (MI6) was operated under the control of a PIC16F690 microcontroller. The wireless communication is handled in a very manner to the SPECTRE with a main module XBeeComm state machine that keeps track of whether the MI6 is unpaired, attempting to pair, or paired. Separate modules TX_SM and RX_SM handle the specifics for sending and receiving messages over UART with an XBee wireless device. IO_Service handles the initialization of the ADC module for reading in analog values from the accelerometer attached to the gun. Because we are reading two analog values (linear potentiometer connected to trigger and accelerometer with orientation data) it was necessary to periodically switch ADC channels. The IO module also keeps track of the state of the watch team select, paired indicator LED, and braking. The EventCheckers module looks out for button presses for pair/unpair and balloon popping requests as well as UART receive interrupts and rising/falling edges on both encoder inputs. The .c and .h files are included below for your viewing pleasure.