feat: implemente ultrasond in Capteur
This commit is contained in:
19
IOT/lib/Capteur/src/Ultrason.cpp
Normal file
19
IOT/lib/Capteur/src/Ultrason.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include "../include/Ultrason.h"
|
||||
|
||||
|
||||
|
||||
Ultrason::Ultrason(int trigeur, int echo, String fullVall):
|
||||
Capteur("D",fullVall){
|
||||
this->capteur = new Ultrasonic(trigeur, echo);
|
||||
}
|
||||
|
||||
String Ultrason::read(){
|
||||
int sortie = this->capteur->read();
|
||||
if (sortie > this->fullVall.toInt())
|
||||
{
|
||||
this->full = true;
|
||||
}else{
|
||||
this->full = false;
|
||||
}
|
||||
return String(sortie);
|
||||
}
|
Reference in New Issue
Block a user