The code found in Getting Started with the TSL230R and Arduino only instructs the microcontroller to send data. By using the code snippet from Tod E. Kurt’s website listed below. We can extend TSL230R_basic_example.pde by adding a simple serial protocol that allows the microcontroller to receive commands sent from the host computer.

This command waits three seconds for the bootloader to load the program (-d 3000) then it tells the program to set the sensitivity to 1x (s001), the frequency scaling to divide-by-2 (f002), turn the light on (l111), and transmit five samples (t005). The command then waits 10 seconds for the buffer to fill (-d 10000), reads five samples (-r -d 500 repeated five times), and finally turns the light off. The blank lines in the output are from the line feed (i.e. /n) printed after each number. The uc code uses Serial.print('\n') instead of Serial.println() and the string “EOT” so that it can communicate with code written for GNU Octave and MATLAB.