Skip to main content

Posts

Ultrasonic Sensor HC-SR04 with Arduino Tutorial

Ultrasonic Sensor HC-SR04 with Arduino Tutorial You will learn how to interface Ultrasonic Sensor HC-SR04 with Arduino. It can be an Ultrasonic Range Sensor or any purposes. ABOUT THIS PROJECT- Ultrasonic Sensor HC-SR04 is a sensor that can measure  distance . It emits an  ultrasound  at  40 000 Hz (40kHz)  which travels through the air and if there is an object or obstacle on its path It will bounce back to the module. Considering the travel time and the speed of the sound you can calculate the distance. The configuration pin of HC-SR04 is VCC (1), TRIG (2), ECHO (3), and GND (4). The  supply voltage  of VCC is  +5V  and you can attach TRIG and ECHO pin to any Digital I/O in your Arduino Board. Ultrasonic Sensor HC-SR04 Configuration and Specification Ultrasonic Sensor HC-SR04 Principle The  materials  that we need to make this project: 1. Arduino UNO R3 CH340 (you can use any Arduino Boards) 2. Ultrasonic Sensor HC-SR04 3. Male to...

Program for array rotation

  Program for array rotation Difficulty Level :   Easy Last Updated :   16 Apr, 2021   Write a function rotate(ar[], d, n) that rotates arr[] of size n by d elements.  # Python3 program to rotate an array by # d elements # Function to left rotate arr[] of size n by d*/ def leftRotate(arr, d, n):      for i in range (d):          leftRotatebyOne(arr, n)   # Function to left Rotate arr[] of size n by 1*/ def leftRotatebyOne(arr, n):      temp = arr[ 0 ]      for i in range (n - 1 ):          arr[i] = arr[i + 1 ]      arr[n - 1 ] = temp              # utility function to print an array */ def printArray(arr, size):      for i in range (size):          print ( "% d" % arr[i], end =...