Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: IR_sensors.h
- Revision:
- 0:7676da98b5c1
diff -r 000000000000 -r 7676da98b5c1 IR_sensors.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/IR_sensors.h Tue Mar 26 03:27:14 2019 +0000
@@ -0,0 +1,41 @@
+
+#ifndef IR_sensors_H
+#define IR_sensors_H
+
+#include "mbed.h"
+enum State {left = 0b100,
+ centerleft = 0b110,
+ center = 0b010,
+ centerright = 0b011,
+ right= 0b001,
+ undef0 = 0b000,
+ undef1 = 0b111,
+ undefx = 0b101
+ };
+
+class IR_sensors {
+ public:
+ IR_sensors(
+ PinName pinleft,
+ PinName pincenter,
+ PinName pinright,
+ PinName ledleft,
+ PinName ledcenter,
+ PinName ledright
+ );
+
+ State state(void);
+ protected:
+ DigitalIn _pinleft;
+ DigitalIn _pincenter;
+ DigitalIn _pinright;
+ DigitalOut _ledleft;
+ DigitalOut _ledcenter;
+ DigitalOut _ledright;
+ State _state;
+
+
+};
+
+
+#endif