Arduino Tutorial #2: How to use LED Sensor with Arduino Uno.
#arduino #arduinouno #arduinoproject
Arduino Tutorial #1: How to use LED Sensor with Arduino Uno.
In this tutorial you will learn about how to use 5V Led Sensor with Arduino Uno.
----------------------------------------------------------------------------------------------------------------
Code
----------------------------------------------------------------------------------------------------------------
//Defining variable and the GPIO pin on Arduino
int greenPin = 7;
int bluePin = 6;
int redPin= 5;
int timer=100;
void setup() {
//Defining the pins as OUTPUT
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
void loop() {
setColor(255, 0, 0); // Red Color
delay(timer);
setColor(0, 255, 0); // Green Color
delay(timer);
setColor(0, 0, 255); // Blue Color
delay(timer);
setColor(255, 255, 255); // White Color
delay(timer);
setColor(170, 0, 255); // Purple Color
delay(timer);
setColor(127, 127, 127); // Light Blue
delay(timer);
}
void setColor(int redValue, int greenValue, int blueValue) {
analogWrite(redPin, redValue);
analogWrite(greenPin, greenValue);
analogWrite(bluePin, blueValue);
}
Hope this tutorial was useful. Please hit LIKE for more Arduino tutorial and subscribe to stay tuned.
Видео Arduino Tutorial #2: How to use LED Sensor with Arduino Uno. канала Arduino Projects
Arduino Tutorial #1: How to use LED Sensor with Arduino Uno.
In this tutorial you will learn about how to use 5V Led Sensor with Arduino Uno.
----------------------------------------------------------------------------------------------------------------
Code
----------------------------------------------------------------------------------------------------------------
//Defining variable and the GPIO pin on Arduino
int greenPin = 7;
int bluePin = 6;
int redPin= 5;
int timer=100;
void setup() {
//Defining the pins as OUTPUT
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
void loop() {
setColor(255, 0, 0); // Red Color
delay(timer);
setColor(0, 255, 0); // Green Color
delay(timer);
setColor(0, 0, 255); // Blue Color
delay(timer);
setColor(255, 255, 255); // White Color
delay(timer);
setColor(170, 0, 255); // Purple Color
delay(timer);
setColor(127, 127, 127); // Light Blue
delay(timer);
}
void setColor(int redValue, int greenValue, int blueValue) {
analogWrite(redPin, redValue);
analogWrite(greenPin, greenValue);
analogWrite(bluePin, blueValue);
}
Hope this tutorial was useful. Please hit LIKE for more Arduino tutorial and subscribe to stay tuned.
Видео Arduino Tutorial #2: How to use LED Sensor with Arduino Uno. канала Arduino Projects
Комментарии отсутствуют
Информация о видео
29 июня 2025 г. 22:08:29
00:02:20
Другие видео канала