Arduino Tutorial #13: How to use Photo Interrupter with Arduino , ( 9 of 37 Sensor Kit)#arduino
@DIY_Arduino_Projects
Full Video: https://youtu.be/_JwEeDH-W9A
Arduino Tutorial #13: How to use Photo Interrupter Sensor with Arduino UNO, (9 of 37 Arduino Sensor Kit).
-----------
CODE
------------
/*
This is 9 of 37 Sensors Tutorial code
NOTE: Please replace $ sign with open and close Angle brackets in the code below, because YOUTUBE won't let me include angle brackets in video's Description.
*/
#include $LiquidCrystal_I2C.h$ //In this line Please replace $ sign with open and close Angle brackets
//connections SDA--A4 and SCL--A5
//initialize the liquid crystal library
//the first parameter is the I2C address
LiquidCrystal_I2C lcd(0x27, 16, 2);
int SensorPin = 8;
int ledPin = LED_BUILTIN;
int state = 0;
void setup() {
lcd.init(); //initialize lcd screen
lcd.backlight(); // turn on the backlight
pinMode(ledPin, OUTPUT);
pinMode(SensorPin, INPUT);
}
void loop() {
delay(100);
state = digitalRead(SensorPin);
lcd.clear();
lcd.setCursor(0, 0); //write on the top row
lcd.print("Sensor Data: ");
lcd.print(state);
if (state == LOW) {
digitalWrite(ledPin, LOW);
} else {
digitalWrite(ledPin, HIGH);
lcd.setCursor(0, 1); //write on the bottom row
lcd.print("Object Detected");
}
}
Hope this tutorial was useful. Please hit LIKE for more Arduino tutorial and subscribe to stay tuned.
#arduino #arduinouno #arduinoproject #diy #diyprojects #arduinotutorial #linetracking #linetrackingsensor
Видео Arduino Tutorial #13: How to use Photo Interrupter with Arduino , ( 9 of 37 Sensor Kit)#arduino канала Arduino Projects
Full Video: https://youtu.be/_JwEeDH-W9A
Arduino Tutorial #13: How to use Photo Interrupter Sensor with Arduino UNO, (9 of 37 Arduino Sensor Kit).
-----------
CODE
------------
/*
This is 9 of 37 Sensors Tutorial code
NOTE: Please replace $ sign with open and close Angle brackets in the code below, because YOUTUBE won't let me include angle brackets in video's Description.
*/
#include $LiquidCrystal_I2C.h$ //In this line Please replace $ sign with open and close Angle brackets
//connections SDA--A4 and SCL--A5
//initialize the liquid crystal library
//the first parameter is the I2C address
LiquidCrystal_I2C lcd(0x27, 16, 2);
int SensorPin = 8;
int ledPin = LED_BUILTIN;
int state = 0;
void setup() {
lcd.init(); //initialize lcd screen
lcd.backlight(); // turn on the backlight
pinMode(ledPin, OUTPUT);
pinMode(SensorPin, INPUT);
}
void loop() {
delay(100);
state = digitalRead(SensorPin);
lcd.clear();
lcd.setCursor(0, 0); //write on the top row
lcd.print("Sensor Data: ");
lcd.print(state);
if (state == LOW) {
digitalWrite(ledPin, LOW);
} else {
digitalWrite(ledPin, HIGH);
lcd.setCursor(0, 1); //write on the bottom row
lcd.print("Object Detected");
}
}
Hope this tutorial was useful. Please hit LIKE for more Arduino tutorial and subscribe to stay tuned.
#arduino #arduinouno #arduinoproject #diy #diyprojects #arduinotutorial #linetracking #linetrackingsensor
Видео Arduino Tutorial #13: How to use Photo Interrupter with Arduino , ( 9 of 37 Sensor Kit)#arduino канала Arduino Projects
Arduino Arduino tutorial diy arduino project 37 Sensor kit arduino 37 sensor kit photo interrupter sensor tutorial How to use photo interrupter sensor with arduino photo interrupter sensor example how to use photo interrupter sensor photo interrupter sensor arduino photo interrupter arduino project diy diy projects arduino diy project i2c display i2c display arduino i2c display tutorial display data i2c
Комментарии отсутствуют
Информация о видео
14 июля 2025 г. 21:41:32
00:01:59
Другие видео канала