#include <Wire.h>
#include <Adafruit_NeoPixel.h>
// Define NeoPixel pins and ESP32 GPIOs
const int redPin = 12;
const int greenPin = 13;
const int bluePin = 14;
// Create a NeoPixel instance
Adafruit_NeoPixel strip(1, redPin, NEO_GRB + NEO_KHZ800);
void setup() {
// Start serial communication for debugging
Serial.begin(115200);
// Initialize NeoPixel
strip.begin();
strip.show(); // Initialize all LEDs to off
// Set up RGB pins
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
void loop() {
// Simulate GPS data
float latitude = 6.8745; // Example: Colombo latitude
float longitude = 79.8917; // Example: Colombo longitude
// Print simulated GPS data
Serial.print("Latitude: ");
Serial.print(latitude, 6);
Serial.print(" Longitude: ");
Serial.println(longitude, 6);
// Simulate the truck status: Example for Active truck
strip.setPixelColor(0, strip.Color(0, 255, 0)); // Green for Active
strip.show();
delay(1000); // Update every second
}