diff --git a/README.md b/README.md index abafe04..e00a80d 100644 --- a/README.md +++ b/README.md @@ -7,19 +7,13 @@ Implementation of a Speed Limit Indication System Using a GPS Module Objectives: 1. The LED system on the microcontroller should indicate the vehicle's speed range using different colors for specific speed intervals. -2. The LED should remain off when the vehicle speed is equal to 0 km/hr. -3. The Green LED should turn on when the vehicle speed is greater than 0 km/hr and below 15 km/hr. -4. The Yellow LED should turn on when the vehicle speed is greater than or equal to 15 km/hr and below 30 km/hr. -5. The Red LED should turn on when the vehicle speed is greater than or equal to 30 km/hr and below 40 km/hr. -6. The Red LED should blink rapidly when the vehicle speed is greater than 40 km/hr. +2. The Green color LED should turn on when the vehicle speed is in between 0 km/hr and below 10 km/hr. +3. The Cyan color LED should turn on when the vehicle speed is in between 10 km/hr and below 20 km/hr. +4. The blue color LED should turn on when the vehicle speed is in between 20 km/hr and below 30 km/hr. +5. The Yellow color LED should turn on when the vehicle speed is in between 30 km/hr and below 40 km/hr. +6. The Red color LED should turn on when the vehicle speed is in between 40 km/hr and below 50 km/hr. +5. The White color LED should turn on when the vehicle speed is above 50 km/hr. -Tasks : -1. Initalize UART for receiving data - Completed -2. Add Read data function - Completed -3. LED indication configuration - Completed -4. Initialize buffer to store data - Pending -5. Add received data to the buffer - Pending -6. Use received data to meet objectives - Pending ![Block](block.png) diff --git a/main.c b/main.c index 8e572eb..97331a0 100644 --- a/main.c +++ b/main.c @@ -58,15 +58,15 @@ void control_leds_based_on_speed(float speed_kmh) // Control LEDs based on spe if (speed_kmh >= 0.0 && speed_kmh < 10.0) // Range 0-10 km/h { - GPIO_PORTF_DATA_R |= 0x08; // Red LED + GPIO_PORTF_DATA_R |= 0x08; // Green LED } else if (speed_kmh >= 10.0 && speed_kmh < 20.0) // Range 10-20 km/h { - GPIO_PORTF_DATA_R |= 0x0C; // Blue LED + GPIO_PORTF_DATA_R |= 0x0C; // Cyan LED } else if (speed_kmh >= 20.0 && speed_kmh < 30.0) // Range 20-30 km/h { - GPIO_PORTF_DATA_R |= 0x04; // Green LED + GPIO_PORTF_DATA_R |= 0x04; // Blue LED } else if (speed_kmh >= 30.0 && speed_kmh < 40.0) // Range 30-40 km/h { @@ -74,11 +74,11 @@ void control_leds_based_on_speed(float speed_kmh) // Control LEDs based on spe } else if (speed_kmh >= 40.0 && speed_kmh < 50.0) // Range 40-50 km/h { - GPIO_PORTF_DATA_R |= 0x02; // Blue LED + GPIO_PORTF_DATA_R |= 0x02; // RED LED } else // Above 50 km/h { - GPIO_PORTF_DATA_R |= 0x0E; // Maximum LED (Red + Blue + Green) + GPIO_PORTF_DATA_R |= 0x0E; // White LED (Red + Blue + Green) } }