Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
changed from Analog to Digital
  • Loading branch information
nihal-sahu committed May 11, 2022
commit ef2554f6ae1129c1f56543b29fc57335d6f57a39
2 changes: 1 addition & 1 deletion libs/sensors/include/ProximitySwitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ class ProximitySwitch final : Sensor {
[[nodiscard]] bool update() override {}

private:
AnalogIn m_proximity_in_adc;
DigitalIn m_proximity_in_adc;
};
} // namespace Sensor
2 changes: 1 addition & 1 deletion libs/sensors/src/ProximitySwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ProximitySwitch::ProximitySwitch(PinName proximity_in) : m_proximity_in_adc(prox
/*https://www.dfrobot.com/product-2025.html*/
float ProximitySwitch::read() {
if (m_proximity_in_adc.is_connected()) {
return m_proximity_in_adc.read()
return m_proximity_in_adc.read();
} else {
Utility::logger << "ERROR: Sensor pin not connected";
return 2;
Expand Down