filmov
tv
Arduino Tutorial Project 11 | Arduino Project Using No External Components

Показать описание
@nodemonitor
Arduino Tutorial Project 11 | Arduino Project Using No External Components.
In this video we just wanted to show how without using any external components, we can create a project and we can drive a relay directly. This is the most simple and interesting project. This uses INPUT_PULLUP command. When we use this command against any PIN that pin becomes input pin which requires no external components. Internally this pin is pulled up to 5 volt using a 20 Kilo Ohms resistor. When we do not press the push button switch, the input pin remains HIGH, when pressed it goes LOW.
The link to the code given below.
Full code
/*
Input Pull-up Serial
*/
void setup() {
//start serial connection
//configure pin 2 as an input and enable the internal pull-up resistor
pinMode(2, INPUT_PULLUP);
pinMode(13, OUTPUT);
}
void loop() {
//read the pushbutton value into a variable
int sensorVal = digitalRead(2);
//print out the value of the pushbutton
// Keep in mind the pull-up means the pushbutton's logic is inverted. It goes
// HIGH when it's open, and LOW when it's pressed. Turn on pin 13 when the
// button's pressed, and off when it's not:
if (sensorVal == HIGH) {
digitalWrite(13, LOW);
} else {
digitalWrite(13, HIGH);
}
}
Arduino Tutorial Project 11 | Arduino Project Using No External Components.
In this video we just wanted to show how without using any external components, we can create a project and we can drive a relay directly. This is the most simple and interesting project. This uses INPUT_PULLUP command. When we use this command against any PIN that pin becomes input pin which requires no external components. Internally this pin is pulled up to 5 volt using a 20 Kilo Ohms resistor. When we do not press the push button switch, the input pin remains HIGH, when pressed it goes LOW.
The link to the code given below.
Full code
/*
Input Pull-up Serial
*/
void setup() {
//start serial connection
//configure pin 2 as an input and enable the internal pull-up resistor
pinMode(2, INPUT_PULLUP);
pinMode(13, OUTPUT);
}
void loop() {
//read the pushbutton value into a variable
int sensorVal = digitalRead(2);
//print out the value of the pushbutton
// Keep in mind the pull-up means the pushbutton's logic is inverted. It goes
// HIGH when it's open, and LOW when it's pressed. Turn on pin 13 when the
// button's pressed, and off when it's not:
if (sensorVal == HIGH) {
digitalWrite(13, LOW);
} else {
digitalWrite(13, HIGH);
}
}