programmershourya
Published © GPL3+

Your fist program

This is for beginners who want to start learning with arduino Uno. made by shourya wadhwa

BeginnerProtip30 minutes402
Your fist program

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
JS Series Switch
C&K Switches JS Series Switch
×1
Jumper wires (generic)
Jumper wires (generic)
×1
LED (generic)
LED (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Breadboard, 170 Pin
Breadboard, 170 Pin

Story

Read more

Schematics

LED AND A BUTTON

Code

Led and button

Arduino
int button = 0;//button is a variable which means at zero

void setup() {
  #define led 13 
  #define buttonpin 10
  pinMode(buttonpin,INPUT);
  pinMode(led,OUTPUT);
  Serial.begin(9600);
}

void loop () {
  button = digitalRead(buttonpin);
 if (button == HIGH){
 Serial.println("led on");
 digitalWrite(led,HIGH);
  delay(100);
 }else{
  Serial.println("led off") ;
  digitalWrite(led,LOW);
  delay(100);
 }
 }

Credits

programmershourya

programmershourya

2 projects • 0 followers

Comments