ARD106/206 PROJECTS (ARDUINO COURSE)

Project 1 – Blinking LED

CIRCUIT   CODE

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 13 as an output.
  pinMode(13, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

Project 2 – Push Button

CIRCUIT

 

CODE

void setup() {
   // initialize the LED pin (PIN 8) as an output:
   pinMode(8, OUTPUT);
   // initialize the pushbutton pin (PIN 12) as an input:
   pinMode(12, INPUT);
}

void loop() {

   // if push button is pressed, turn the LED ON
   if (digitalRead(12) == HIGH) {
       // turn LED on:
      digitalWrite(8, HIGH);
   } else {
      // turn LED off:
   digitalWrite(8, LOW);
   }
}

Project 3 – Buzzer

CIRCUIT

 

CODE

int BuzzerPin = 9;

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:

  tone (BuzzerPin, 500);
  delay (1000);
  noTone (BuzzerPin);

}

 

Pin It on Pinterest