| Algorithm 1. Laser Transmitter for LCS: |
| TransmitterAlgorithm: Designed to interface with the user, allowing them to select the type of data for transmission. It encodes textual, audio, or image data into a laser-readable format, turning on and off the laser to transmit data as a series of light pulses. |
| Input: Text, Image or Audio |
| Output: Laser turns on and off to transmit the converted bits of data |
| 1: define transmitText(message) function |
| 2: trim newline characters from message |
| 3: transmit special identifier for text data using transmitChar((char)1) |
| 4: for i = 0 to message.length()-1 do |
| 5: transmit message[i] using transmitChar(message[i]) |
| 6: end for |
| 7: transmit newline character using transmitChar(’\n’) |
| 8: end function |
| 9: define transmitAudio() function |
| 10: transmit special identifier for audio data using transmitChar((char)2) |
| 11: initialize startTime as the current time in milliseconds |
| 12: while the difference between the current time and startTime is less than 10000 ms (10 s) do |
| 13: audioValue <- analogRead(audioInPin) |
| 14: scaledValue <- map audioValue from range 0-1023 to 0-255 |
| 15: write scaledValue to ledPin |
| 16: delay for 1000000 / sampleRate microseconds |