Posts

Showing posts with the label Arduino Uno

Led control usign IR sensor in arduino

 int IRSensor = 2; // connect ir sensor to arduino pin 2 int LED = 13; // conect Led to arduino pin 13 void setup()  {   pinMode (IRSensor, INPUT); // sensor pin INPUT   pinMode (LED, OUTPUT); // Led pin OUTPUT } void loop() {   int statusSensor = digitalRead (IRSensor);      if (statusSensor == 1){     digitalWrite(LED, LOW); // LED LOW   }      else   {     digitalWrite(LED, HIGH); // LED High   }    }

Blinking light bulb with relay in Arduino

  int relay = 7; // setting the pin for the relay void setup() {   // put your setup code here, to run once:   pinMode(relay, OUTPUT); } void loop() {    digitalWrite(relay, HIGH); //turning on the realy    delay(1000l); //delaying the relay after on     digitalWrite(relay, LOW); //turning off the relay    delay(1000); //delaying the relay after off }

Led Blink In arduino uno

 // the setup function runs once when you press reset or power the board void setup() {   // initialize digital pin LED_BUILTIN as an output.   pinMode(LED_BUILTIN, OUTPUT); } // the loop function runs over and over again forever void loop() {   digitalWrite(LED_BUILTIN, HIGH);    // turn the LED on (HIGH is the voltage level)   delay(100);                       // wait for a second   digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW   delay(100);                       // wait for a second }