26 lines
405 B
C
26 lines
405 B
C
#ifndef ULTRASOUND_H
|
|
#define ULTRASOUND_H
|
|
|
|
#include <Arduino.h>
|
|
#include <ESP32Servo.h>
|
|
|
|
struct UltrasonicPin
|
|
{
|
|
int trig;
|
|
int echo;
|
|
};
|
|
|
|
struct Ultrasonic
|
|
{
|
|
static UltrasonicPin pin;
|
|
static float distance;
|
|
static void init(UltrasonicPin pin, int servoPin);
|
|
static void update();
|
|
|
|
static int servoPin;
|
|
static int angle;
|
|
static Servo servo;
|
|
static void servoControl(int angle);
|
|
};
|
|
|
|
#endif |