| Algorithm 4. Sending GPS values to Laser Pointer from drone: |
| GPS Algorithm: Transmits the drone’s GPS coordinates to the laser pointer, ensuring precise aiming and optimal communication path. |
| Input: Movements of the drone |
| Output: GPS values sent to the Raspberry Pi |
| 1: define setup() function |
| 2: begin Serial communication at 115200 baud rate |
| 3: initialize GPS using gpsSerial.begin function with GPSBaud, SERIAL_8N1, pins 12 and 15 |
| 4: start Wi-Fi connection with WiFi.begin function using ssid and password |
| 5: while Wi-Fi is not connected do |
| 6: delay for 1000 ms |
| 7: print “Connecting to Wi-Fi...” to the serial monitor |
| 8: end while |
| 9: print “Connected to Wi-Fi” to the serial monitor |
| 10: end function |
| 11: define loop() function |
| 12: while gpsSerial has available data do |
| 13: encode gpsSerial data using gps.encode function |
| 14: if gps location is updated then do |
| 15: create a WiFiClient object named client |
| 16: if client is connected to the server at server_ip and server_port then do |
| 17: define data as the string representation of gps location’s latitude and longitude, separated by a comma |
| 18: send data to the server using client.println function |