Posts

Showing posts from August, 2021

PIR MOTION SENSOR LIGHT USING ARDUINO

Image
  VIDEO LINK: Click Here CODE:  int ledPin = 13;                // choose the pin for the LED int inputPin = 2;               // choose the input pin (for PIR sensor) int pirState = LOW;             // we start, assuming no motion detected int val = 0;                    // variable for reading the pin status int pinSpeaker = 10;           //Set up a speaker on a PWM pin (digital 9, 10, or 11) void setup() {   pinMode(ledPin, OUTPUT);      // declare LED as output   pinMode(inputPin, INPUT);     // declare sensor as input   pinMode(pinSpeaker, OUTPUT);   Serial.begin(9600); } void loop(){   val = digitalRead(inputPin);  // read input value   if (val == HIGH) {            // check if the input is HIGH     digitalWrite(ledPin, HIGH);  // turn LED ON     playTone(300, 160);     delay(150);          if (pirState == LOW) {       // we have just turned on       Serial.println("Motion detected!");       // We only want to print on the output change, not state       pirState = HIGH;

ESP32 CAM GETTING STARTED

Image
  VIDEO LINK: CLICK HERE ESP32 ARDUINO CORE: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json CIRCUIT DIAGRAM:

L298N MOTOR CONTROL USING ARDUINO

Image
  VIDEO LINK:  Click Here CODE: // connect motor controller pins to Arduino digital pins // motor one int enA = 10; int in1 = 9; int in2 = 8; // motor two int enB = 5; int in3 = 7; int in4 = 6; void setup() { // set all the motor control pins to outputs pinMode(enA, OUTPUT); pinMode(enB, OUTPUT); pinMode(in1, OUTPUT); pinMode(in2, OUTPUT); pinMode(in3, OUTPUT); pinMode(in4, OUTPUT); } void demoOne() { // this function will run the motors in both directions at a fixed speed // turn on motor A digitalWrite(in1, HIGH); digitalWrite(in2, LOW); // set speed to 200 out of possible range 0~255 analogWrite(enA, 200); // turn on motor B digitalWrite(in3, HIGH); digitalWrite(in4, LOW); // set speed to 200 out of possible range 0~255 analogWrite(enB, 200); delay(2000); // now change motor directions digitalWrite(in1, LOW); digitalWrite(in2, HIGH); digitalWrite(in3, LOW); digitalWrite(in4, HIGH); delay(2000); // now turn off motors digitalWr