How to run raspberry pi on fritzing

broken image
broken image
broken image

In this case they are the pins number 9 and 10 on the Arduino Board and they are named trigPin and echoPin. } Code language: Arduino ( arduino ) Code Explanationįirst we have to define the Trig and Echo pins. Prints the distance on the Serial Monitor Serial. Reads the echoPin, returns the sound wave travel time in microseconds Sets the trigPin on HIGH state for 10 micro seconds digitalWrite(trigPin, HIGH)

broken image

Clears the trigPin digitalWrite(trigPin, LOW) begin( 9600) // Starts the serial communication PinMode(trigPin, OUTPUT) // Sets the trigPin as an Output pinMode(echoPin, INPUT) // Sets the echoPin as an Input Serial. */ // defines pins numbers const int trigPin = 9 Ultrasonic Sensor HC-SR04 and Arduino Tutorial Here’s a code for measuring distance using the HC-SR04 ultrasonic sensor and Arduino. As an Amazon Associate I earn from qualifying purchases. Breadboard and Jump Wires ……… Amazon / Banggood / AliExpressĭisclosure: These are affiliate links.Arduino Board …………………………… Amazon / Banggood / AliExpress.Ultrasonic Sensor HC-SR04 ………… Amazon / Banggood / AliExpress.You can get these components need for this tutorial from any of the sites below: The Ground and the VCC pins of the module needs to be connected to the Ground and the 5 volts pins on the Arduino Board respectively and the trig and echo pins to any Digital I/O pin on the Arduino Board.

broken image