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: QEI accelerator bit_test cyclic_io cyclic_var cylinder event_var limit mbed mecanum motor_drive pid pid_encoder rs422_put sbdbt servo
Fork of 17robo_Practice1 by
Diff: varEvent.h
- Revision:
- 50:e4e1f38d1bd5
- Child:
- 51:70d45b959d6b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/varEvent.h Wed Sep 13 02:17:38 2017 +0000 @@ -0,0 +1,29 @@ +class varEvent { + +public: + void input(int inputState) { + valState = ((valState<<1)|inputState)&3; + if(valState == 1) { + riseState = 1; + fallState = 0; + } else if(valState == 2){ + riseState = 0; + fallState = 1; + } else { + riseState = 0; + fallState = 0; + } + } + + int getRiseState(){ + return riseState; + } + + int getFallState(){ + return fallState; + } + +private: + int inputState, valState; + int riseState, fallState; +}; \ No newline at end of file