Arduino IoT IoT Projects Videos

Basics of IoT and LED blinking program using Arduino Uno board

In this article we are showing what is IoT (Internet of Things) and how to write your first program in Arduino to blink LED.

Components you needed :-

  1. 1 x Arduino uno board
  2. 1 x USB cable
  3. 1 x Bread board
  4. 1 x LED
  5. 2 x Jumper wire (Male to Male)

Connection :-

Sketch/Source Code :-

int PINNo=5;
void setup() {
pinMode(PINNo,OUTPUT);
}
void loop() {
digitalWrite(PINNo,HIGH);
delay(2000);
digitalWrite(PINNo,LOW);
delay(2000);
}

About the author

IoT Boys

IoT Boys

4 Comments

Click here to post a comment

  • #include
    #include

    #include
    #include
    #define buzzer 13

    int redLED=10; //define the LED pins
    int greenLED= 11;

    const byte rows = 4; //number of the keypad’s rows and columns
    const byte cols = 3;

    char keyMap [rows] [cols] = { //define the cymbols on the buttons of the keypad

    {‘1’, ‘2’, ‘3’, },
    {‘4’, ‘5’, ‘6’, },
    {‘7’, ‘8’, ‘9’, },
    {‘*’, ‘0’, ‘#’, }
    };

    byte rowPins [rows] = {1, 2, 3, 4}; //pins of the keypad
    byte colPins [cols] = {5, 6, 7, };
    Keypad myKeypad = Keypad( makeKeymap(keyMap), rowPins, colPins, rows, cols);
    LiquidCrystal lcd (A0, A1, A2, A3, A4, A5);
    Servo servo;
    String password=”159″;
    int position = 0;
    int wrong=0;
    int total=0;

    void setup() {
    lcd.begin(16, 2);
    pinMode(redLED, OUTPUT); //set the LED as an output
    pinMode(greenLED, OUTPUT);
    lcd.print(“Door lock System”);
    lcd.setCursor(0,2);
    lcd.print( “by” );
    lcd.setCursor(0,2);
    lcd.print(“Engr Hassan”);
    delay(2000);
    servo.attach(13);
    setLocked(true);
    delay(1000);
    pinMode(buzzer,OUTPUT);

    }

    void loop() {
    char pressed=keypad.getkey();
    String key[3];

    if(pressed)
    {
    lcd.clear();

    lcd.setCursor(position,2);
    lcd.print(pressed);
    delay(500);
    if(pressed==”*”||pressed==”#”)
    {
    position=0;
    setLocked(true);
    lcd.clear();}
    else if(pressed==password[position])
    { key[position]=pressed;
    position++;
    }
    else if(pressed!=password[position])
    {
    wrong++;
    position++;
    }
    if(position==3)
    {
    if(wrong>0)
    {
    total++;
    wrong=0;
    position=0;
    lcd.clear();
    lcd.print(“wrong”);
    lcd.setCursor(5,2);
    lcd.print(“password”);
    delay(1000);
    setLocked(true);
    }
    else if(position==3 ” wrong==0)
    {
    position=0
    wrong=0;
    lcd.clear();
    lcd.print(“password”);
    lcd.setCursor(5,2);
    lcd.print(“accepted”);
    delay(1000);
    setLocked(false);
    }
    if(total==3)
    {
    total=0;
    buzzer();
    delay(500);
    }

    }
    }
    lcd.clear();
    lcd.setCursor(16,0);
    lcd.print(“Security lock”);
    lcd.setCursor(16,1);
    lcd.print(“By ENGR HASSAN”);
    dealy(2000);
    while(1)
    {
    lcd.scrollDisplayLeft();
    delay(200);}
    }
    void setLocked(int locked)
    if(locked)
    {
    digitalWrite(redLED,HIGH);
    digitalWrite(greenLED,LOW);
    delay(1000);
    servo.attach(13);
    servo.write(10);
    delay(1000);
    servo.detach();
    }
    else
    {
    digitalWrite(redLED,LOW);
    digitalWrite(greenLED,HIGH);
    delay(1000);
    servo.attach(13);
    servo.write(90);
    delay(1000);
    servo.detach();}
    }

    }

    void buzzer
    {
    digitalWrite(buzzer,HIGH);
    delay(1000);
    digitalWrite(buzzer,LOW);
    delay(1000);
    }
    Please check my code its giving an error

Meet Our Team

Rajeev Ranjan Founder IoTBoys
Founder IoTBoys
Shambhoo kumar
Founder IoTBoys

Subscribe Us