Answers for "newping ultrasonic code"

1

newping ultrasonic code

// Created BY ZOUARI mehdi 
// NewPing ultrasonic sensor arduino 

#include <Arduino.h>
#include <NewPing.h>

#define TRIGGER_PIN 12
#define ECHO_PIN 11
#define MAX_DISTANCE 200

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);

void setup()
{
  Serial.begin(115200);
}

void loop()
{
  delay(50);
  Serial.print("Ping: ");
  Serial.print(sonar.ping_cm());
  Serial.println("cm");
}
Posted by: Guest on April-15-2022

Code answers related to "newping ultrasonic code"

Browse Popular Code Answers by Language