Mustafa Adam
Published

MAKER RP PI 2040 Arduino project; I have this staff to do I

Arduino software, pi Pico port smart car with wills ultrasonic

BeginnerWork in progress216
MAKER RP PI 2040 Arduino project; I have this staff to do I

Things used in this project

Story

Read more

Code

HC-SR04

Arduino
This is code for controlling the moving
#include <HCSR04.h>

byte triggerPin = 4;
byte echoPin = 5;

void setup () {
  Serial.begin(9600);
  HCSR04.begin(triggerPin, echoPin);
}

void loop () {
  double* distances = HCSR04.measureDistanceCm();
  
  Serial.print("1: ");
  Serial.print(distances[0]);
  Serial.println(" cm");
  
  Serial.println("---");
  delay(250);
}

Credits

Mustafa Adam
2 projects • 2 followers

Comments