Загрузка страницы

Arduino Lab: Distance Sensor Using Blockly Arduino

This video tutorial shows you how to use Tinkercad Circuits and Blockly@rduino to program an Arduino to read values from an ultrasonic distance sensor.

For other great tutorials, please subscribe: https://www.youtube.com/remiwauthy

Distance Sensor Lab: http://bit.ly/distanceLab
Blocky@rduino: http://bit.ly/Blocklyrduino
Tinkercad: https://www.tinkercad.com/

Since I cannot find a ultrasonic distance sensor block on Blockly@rduino, I used the code below instead:

int distance;

long readUltrasonicDistance(int triggerPin, int echoPin)
{
pinMode(triggerPin, OUTPUT);
digitalWrite(triggerPin, LOW);
delayMicroseconds(2);
digitalWrite(triggerPin, HIGH);
delayMicroseconds(10);
digitalWrite(triggerPin, LOW);
pinMode(echoPin, INPUT);
return pulseIn(echoPin, HIGH);
}

Use the following line of code within the void loop() section of your code to read the distance in centimeters:
distance = 0.01723 * readUltrasonicDistance(2, 3);

Видео Arduino Lab: Distance Sensor Using Blockly Arduino канала Remi Wauthy
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
4 января 2020 г. 4:21:43
00:10:47
Яндекс.Метрика