유은제gledel
Published

Digital Input

How to input digital with Arduino.

BeginnerProtip1,738
Digital Input

Things used in this project

Story

Read more

Schematics

Schemetic of digital input

Code

code of digital input

EJS
int led_pin = 13;
int sw_pin1 = 2;
int sw_pin2= 8;
int sw1_value;
int sw2_value;

void setup(){
pinMode(led_pin, OUTPUT);
pinMode(sw_pin1, INPUT);
pinMode(sw_pin2, INPUT);
}

void loop(){
sw1_value = digitalRead(sw_pin1);
sw2_value = digitalRead(sw_pin2);
if(sw1_value == LOW){
  digitalWrite(led_pin, HIGH);
}
if(sw2_value == HIGH){
  digitalWrite(led_pin, HIGH);
}
  digitalWrite(led_pin, LOW);
}

Credits

유은제
15 projects • 13 followers
Hello :-) I'm a high school student in South Korea.
Contact
gledel
100 projects • 116 followers
Looking back on my childhood, I was happy when I was making something and I was proud of myself. "Making is instinct!"
Contact

Comments

Please log in or sign up to comment.