feat: capteur-ultrason #27
@ -16,5 +16,8 @@ build_flags =
|
||||
|
||||
-D API_HOST=\"iot.epi.cb85.software\"
|
||||
|
||||
-D ULTRA_SOUND_TRIGD=12
|
||||
-D ULTRA_SOUND_ECHO=13
|
||||
|
||||
-D EXAMPLE_NUMBER=69
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
#ifndef PROGRAM_H
|
||||
#define PROGRAM_H
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Ultrasonic.h>
|
||||
|
||||
class Program{
|
||||
public:
|
||||
/**
|
||||
@ -17,5 +20,11 @@ public:
|
||||
|
||||
private:
|
||||
/* data */
|
||||
|
||||
/**
|
||||
* @brief capteur ultra son pour le niveau de remplissage de la poubelle
|
||||
*
|
||||
*/
|
||||
Ultrasonic *ultrasonic;
|
||||
};
|
||||
#endif
|
@ -38,6 +38,7 @@ monitor_flags =
|
||||
lib_deps =
|
||||
bportaluri/WiFiEsp@^2.2.2 ; gestion des commande 'AT' de l'esp01
|
||||
arduino-libraries/Arduino_JSON@^0.2.0 ; gestion des json
|
||||
ericksimoes/Ultrasonic@^3.0.0 ; lib capteur ultra son
|
||||
; example:
|
||||
; erropix/ESP32 AnalogWrite@^0.2
|
||||
|
||||
|
@ -1,10 +1,18 @@
|
||||
#include "Program.h"
|
||||
|
||||
|
||||
Program::Program(){
|
||||
int distance;
|
||||
|
||||
|
||||
Program::Program(){
|
||||
Serial.begin(MONITOR_SPEED);
|
||||
this->ultrasonic = new Ultrasonic(ULTRA_SOUND_TRIGD, ULTRA_SOUND_ECHO);
|
||||
}
|
||||
|
||||
void Program::loop(){
|
||||
distance = this->ultrasonic->read();
|
||||
|
||||
Serial.print("Distance in CM: ");
|
||||
Serial.println(distance);
|
||||
delay(1000);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user