RoboidControl-cpp/Arduino/Sensors/DigitalInput.cpp
Pascal Serrarens f2f942d084 Refactoring
2025-02-28 15:01:23 +01:00

21 lines
516 B
C++

#include "DigitalInput.h"
#include <Arduino.h>
namespace RoboidControl {
namespace Arduino {
DigitalInput::DigitalInput(Participant* participant, unsigned char pin) : TouchSensor(participant) {
this->pin = pin;
pinMode(pin, INPUT);
}
void DigitalInput::Update(unsigned long currentTimeMs) {
this->touchedSomething = digitalRead(pin) == LOW;
// std::cout << "DigitalINput pin " << (int)this->pin << ": " << this->touchedSomething << "\n";
}
} // namespace Arduino
} // namespace RoboidControl