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.
Dependencies: mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP
Fork of SystemManagement by
Diff: Libs/PollSwitch/PollSwitch.cpp
- Revision:
- 30:91af74a299e1
- Child:
- 36:0afc0fc8f86b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Libs/PollSwitch/PollSwitch.cpp Thu Nov 13 10:53:10 2014 +0000
@@ -0,0 +1,17 @@
+#include "PollSwitch.h"
+
+PollSwitch::PollSwitch(LPCDigitalIn *swArr, int numSw){
+ numSwitches = numSw;
+ sw = swArr;
+}
+
+char PollSwitch::poll(){
+ char i = 0;
+
+ // if a low signal is detected, previous switch is broken
+ for (i = 0; i < numSwitches; i++) {
+ if (!sw[i].read()) break;
+ }
+ if (i >= numSwitches) i = 0;
+ return i+1;
+}
\ No newline at end of file
