Posts

Showing posts from May, 2022

radar using arduino and ultrasonic sensor

Image
                   Radar Using Arduino and Ultrasoic Sensor                     circuit : arduino code : // Includes the Servo library #include <Servo.h>.  // Defines Tirg and Echo pins of the Ultrasonic Sensor const int trigPin = 10; const int echoPin = 11; // Variables for the duration and the distance long duration; int distance; Servo myServo; // Creates a servo object for controlling the servo motor void setup() {   pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output   pinMode(echoPin, INPUT); // Sets the echoPin as an Input   Serial.begin(9600);   myServo.attach(12); // Defines on which pin is the servo motor attached } void loop() {   // rotates the servo motor from 15 to 165 degrees   for(int i=15;i<=165;i++){     myServo.write(i);   delay(30);   distance = calculateDistance();// Calls a function for ...

circuit diagram and code for distance measuring using arduino

Image
   Distance measuring using Arduino UNO and Ultrasonic sensor  Arduino code :  /* HC-SR04 Ultrasonic Sensor with LCD dispaly HC-SR04 Ultrasonic Sensor   VCC to Arduino 5V   GND to Arduino GND   Echo to Arduino pin 12   Trig to Arduino pin 13 LCD Display (I used JHD162A)    VSS to Arduino GND   VCC to Arduino 5V   VEE to Arduino GND   RS to Arduino pin 11   R/W to Arduino pin 10   E to Arduino pin 9   DB4 to Arduino pin 2   DB5 to Arduino pin 3   DB6 to Arduino pin 4   DB7 to Arduino pin 5   LED+ to Arduino 5V   LED- to Arduino GND    Modified by Ahmed Djebali (June 1, 2015). */ #include <LiquidCrystal.h> //Load Liquid Crystal Library LiquidCrystal LCD(11,10,9,2,3,4,5);  //Create Liquid Crystal Object called LCD #define trigPin 13 //Sensor Echo pin connected to Arduino pin 13 #define echoPin 12 //Sensor Trip pin connected to Arduino pin 12 //Simple program just fo...

circuit and code for led chaser

Image
 LED CHASER USING ARDUINO  CODE :  /* A simple program to sequentially turn on and turn off 12 LEDs */  int LED1 = 13; int LED2 = 12; int LED3 = 11; int LED4 = 10; int LED5 = 9; int LED6 = 8; int LED7 = 7; int LED8 = 6; int LED9 = 5; int LED10 = 4; int LED11 = 3; int LED12 = 2; void setup() {    pinMode(LED1, OUTPUT);    pinMode(LED2, OUTPUT);    pinMode(LED3, OUTPUT);    pinMode(LED4, OUTPUT);    pinMode(LED5, OUTPUT);    pinMode(LED6, OUTPUT);    pinMode(LED7, OUTPUT);    pinMode(LED8, OUTPUT);    pinMode(LED9, OUTPUT);    pinMode(LED10, OUTPUT);    pinMode(LED11, OUTPUT);    pinMode(LED12, OUTPUT); } void loop() {   digitalWrite(LED1, HIGH);    // turn on LED1    delay(100);                  // wait for 200ms   digitalWrite(LED2, HIGH);    // turn on LED2   ...