Merge pull request 'feat: capteur-ultrason' (#27) from feat--capteur-ultrason into master
Reviewed-on: Epitech-T-DEV-811/T-DEV-811#27 Reviewed-by: 5OLE1L <mathis.ragot@epitech.eu> Reviewed-by: nico <nicolas.sansd@gmail.com>
This commit is contained in:
commit
370a16441b
@ -16,5 +16,8 @@ build_flags =
|
|||||||
|
|
||||||
-D API_HOST=\"iot.epi.cb85.software\"
|
-D API_HOST=\"iot.epi.cb85.software\"
|
||||||
|
|
||||||
|
-D ULTRA_SOUND_TRIGD=12
|
||||||
|
-D ULTRA_SOUND_ECHO=13
|
||||||
|
|
||||||
-D EXAMPLE_NUMBER=69
|
-D EXAMPLE_NUMBER=69
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#ifndef PROGRAM_H
|
#ifndef PROGRAM_H
|
||||||
#define PROGRAM_H
|
#define PROGRAM_H
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <Ultrasonic.h>
|
||||||
|
|
||||||
class Program{
|
class Program{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@ -17,5 +20,11 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/* data */
|
/* data */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief capteur ultra son pour le niveau de remplissage de la poubelle
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Ultrasonic *ultrasonic;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
@ -38,6 +38,7 @@ monitor_flags =
|
|||||||
lib_deps =
|
lib_deps =
|
||||||
bportaluri/WiFiEsp@^2.2.2 ; gestion des commande 'AT' de l'esp01
|
bportaluri/WiFiEsp@^2.2.2 ; gestion des commande 'AT' de l'esp01
|
||||||
arduino-libraries/Arduino_JSON@^0.2.0 ; gestion des json
|
arduino-libraries/Arduino_JSON@^0.2.0 ; gestion des json
|
||||||
|
ericksimoes/Ultrasonic@^3.0.0 ; lib capteur ultra son
|
||||||
; example:
|
; example:
|
||||||
; erropix/ESP32 AnalogWrite@^0.2
|
; erropix/ESP32 AnalogWrite@^0.2
|
||||||
|
|
||||||
|
@ -1,10 +1,18 @@
|
|||||||
#include "Program.h"
|
#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(){
|
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