Good night,
Going on with my adventures with Arduino and sensors, today I decided to play with Ultrasonic sensor HC-SR04 to measure distance.
HC-SR04 is pretty easy to work with, it has 4 pins, VCC to energy, Trig to start a measurement, Echo to get the distance, and GND to ground.
It has a library to get it working, it is called Ultrasonic. The only problem that I had was the Library is out of date, it still uses WProgram.h but Arduino 1.0.1 uses Arduino.h, so I updated it. (You can get on the end of the post).
The library must be included on your dir “arduino-1.0.1/libraries” and you must restart your IDE.
Sensor VCC connects to Arduino +5V pin
Sensor Trig connects to Arduino PIN 12
Sensor Echo connects to Arduino PIN 13
Sensor GND connnects to Arduino GND PIN
You can configure it on trig and echo variables.
[code lang=”c”]
#include “Ultrasonic.h”
int trig = 12;
int echo = 13;
Ultrasonic ultrasonic(trig,echo);
void setup() {
Serial.begin(9600);
}
void loop()
{
Serial.print(“Distance CM:”);
Serial.println(ultrasonic.Ranging(CM));
Serial.print(“Distance INC:”);
Serial.println(ultrasonic.Ranging(INC));
delay(100);
}
[/code]
Referências:
HC-SR04 DataSheet
Biblioteca Ultrasonic atualizada para Arduino 1.0.1
https://annytarshw.wordpress.com
https://jllbczbfhi.wordpress.com
1win киберспорт https://1win96781.help
https://jllbczbfhi.wordpress.com
https://jllbczbfhi.wordpress.com
mostbet Токмок https://www.mostbet54173.help
https://mxxpjxvlwe.wordpress.com
https://mxxpjxvlwe.wordpress.com
1win asistenta clienti 1win asistenta clienti
https://tzvpbpffwr.wordpress.com
mostbet yangi mirror mostbet yangi mirror
pin up Humo depozit pin up Humo depozit
https://tzvpbpffwr.wordpress.com
https://rzyagpqmfu.wordpress.com
https://rzyagpqmfu.wordpress.com
https://hdvbdoihfh.wordpress.com
https://hdvbdoihfh.wordpress.com
https://hdvbdoihfh.wordpress.com
https://hdvbdoihfh.wordpress.com
https://tntvgdepwl.wordpress.com
https://tntvgdepwl.wordpress.com
https://tntvgdepwl.wordpress.com
вывод из запоя в стационаре vyvod-iz-zapoya-v-staczionare-sankt-peterburg-1.ru .
https://tntvgdepwl.wordpress.com
https://tntvgdepwl.wordpress.com
лечение наркомании vyvod-iz-zapoya-v-staczionare-sankt-peterburg-1.ru .
https://tkygkspzem.wordpress.com
mostbet cashout ishlamayapti https://www.mostbet82059.help
https://tkygkspzem.wordpress.com
https://tkygkspzem.wordpress.com
https://wukuelmgsn.wordpress.com
melbet MasterCard депозит melbet MasterCard депозит
https://wukuelmgsn.wordpress.com
https://wukuelmgsn.wordpress.com
1win official english site http://www.1win60751.help
https://fszzejcvcq.wordpress.com
melbet statistici meci https://melbet18567.help
установка melbet apk инструкция http://melbet23481.help
https://fszzejcvcq.wordpress.com
https://iwknguzraa.wordpress.com
crash online melbet crash online melbet
вывод melbet на qiwi https://melbet23481.help
melbet рабочее зеркало россия https://melbet23481.help/
1win download official https://www.1win60751.help
1win бонуси депозит 1win бонуси депозит
sweet bonanza link app ios México sweet bonanza link app ios México
1win app download 1win60751.help