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
domeo ремонт квартир отзывы domeo ремонт квартир отзывы .
поставка медоборудования medicinskoe-oborudovanie-77.ru .
online casina online casina .
mostbet rasmiy kirish http://mostbet69573.help/
работа в алматы umicum.kz .
честные отзывы о domeo честные отзывы о domeo .
работа тараз работа тараз .
мостбет хоккей ставки https://mostbet90387.help/
mostbet sport bolimi https://www.mostbet69573.help
медицинская аппаратура medicinskoe-oborudovanie-213.ru .
казахмыс вакансии вахта казахмыс вакансии вахта .
1вин мобилӣ https://www.1win71839.help
smm менеджер вакансии umicum.kz .
nov? online casino nov? online casino .
mostbet komissiya bormi http://www.mostbet69573.help
1win дар Истаравшан 1win71839.help
https://t.me/s/officlal_1win/504
https://t.me/s/officlal_1win/430
1win корт 1win71839.help
мостбет вход в личный кабинет мостбет вход в личный кабинет
Hi there, just wanted to tell you, I loved this post. It was funny. Keep on posting!
мостбет пополнить баланс http://www.mostbet90387.help
I visited multiple blogs however the audio feature for audio songs current at this site is really wonderful.
Трезвый выбор https://medanalises.net/bolezni/nuzhen-narkolog-na-dom-v-krasnodare.html .
trezviy-vibor http://www.limage-ufa.ru/narkolog-na-dom-v-rostove-na-donu/ .
pin-up canlı baccarat pinup21680.help
медицинское оборудование россия медицинское оборудование россия .
втб не переводит http://www.vtb-ne-rabotaet.ru .
mostbet ставки на футбол Кыргызстан mostbet ставки на футбол Кыргызстан
комплексное внедрение 1с 1s-vnedrenie.ru .
pin-up Azərbaycan sayt pin-up Azərbaycan sayt
trezviy-vibor http://prostatit-prostata.ru/narkolog-na-dom-v-volgograde-anonimno// .
сопровождение 1с 8 3 сопровождение 1с 8 3 .
mostbet банковская карта пополнение http://mostbet93746.help/
внедрение системы 1с внедрение системы 1с .
I will immediately grasp your rss as I can not find your email subscription link or newsletter service. Do you’ve any? Kindly let me realize so that I could subscribe. Thanks.
1с услуги сопровождение 1с услуги сопровождение .
trezviy-vibor https://detkiportal.ru/vyvod-iz-zapoya-v-donecke-anonimno// .
I am sure this article has touched all the internet viewers, its really really pleasant piece of writing on building up new website.
mostbet скачать на андроид mostbet93746.help
pin-up slot oyunları pin-up slot oyunları