This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Line-Marking Vehicle Robot Arduino Code | |
| ## Project Description | |
| The Arduino code program controls the movement of the model robot that is used to mark lines. The robot is provided with an array of five sensors for line tracking, a motor driver for driving the DC motors, speed control through potentiometer, and a NeoPixel LED strip for indicating the selected speed. | |
| ## Main Features | |
| - Reads five analog reflectance sensors. | |
| - Calculates the robot’s position relative to the line. | |
| - Adjusts motor speeds to stay centered on the path. | |
| - Uses a potentiometer for variable speed control. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Adafruit_NeoPixel.h> // Includes the Adafruit NeoPixel library so the LED strip can be controlled. | |
| #define LED_PIN 3 // Sets the Arduino pin connected to the NeoPixel data line. | |
| #define NUMPIXELS 8 // Sets the number of NeoPixels in the LED strip. | |
| Adafruit_NeoPixel pixels(NUMPIXELS, LED_PIN, NEO_GRB + NEO_KHZ800); // Creates the NeoPixel object using the number of LEDs, pin, and LED signal type. | |
| // Sensors: S1 = left, S5 = right // Notes the physical sensor order from left to right. | |
| const int S1 = A5; // Assigns the far-left sensor to analog pin A5. | |
| const int S2 = A4; // Assigns the left-center sensor to analog pin A4. |