Willem Melching
/
bootje_v4
uitvoer/roer.cpp@0:bec310bde899, 2011-09-27 (annotated)
- Committer:
- pd0wm
- Date:
- Tue Sep 27 19:46:30 2011 +0000
- Revision:
- 0:bec310bde899
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pd0wm | 0:bec310bde899 | 1 | #include "roer.h" |
pd0wm | 0:bec310bde899 | 2 | |
pd0wm | 0:bec310bde899 | 3 | Roer::Roer():led(LED2),rudder(p21) { |
pd0wm | 0:bec310bde899 | 4 | stand = 50; |
pd0wm | 0:bec310bde899 | 5 | this->write(); |
pd0wm | 0:bec310bde899 | 6 | } |
pd0wm | 0:bec310bde899 | 7 | |
pd0wm | 0:bec310bde899 | 8 | void Roer::set(int a) { |
pd0wm | 0:bec310bde899 | 9 | stand = a; |
pd0wm | 0:bec310bde899 | 10 | if (stand > 76) |
pd0wm | 0:bec310bde899 | 11 | stand = 76; |
pd0wm | 0:bec310bde899 | 12 | if (stand < 5) |
pd0wm | 0:bec310bde899 | 13 | stand = 5; |
pd0wm | 0:bec310bde899 | 14 | |
pd0wm | 0:bec310bde899 | 15 | |
pd0wm | 0:bec310bde899 | 16 | this->write(); |
pd0wm | 0:bec310bde899 | 17 | } |
pd0wm | 0:bec310bde899 | 18 | |
pd0wm | 0:bec310bde899 | 19 | int Roer::get(void) { |
pd0wm | 0:bec310bde899 | 20 | return stand; |
pd0wm | 0:bec310bde899 | 21 | } |
pd0wm | 0:bec310bde899 | 22 | |
pd0wm | 0:bec310bde899 | 23 | void Roer::write(void){ |
pd0wm | 0:bec310bde899 | 24 | led = stand / 100.0; |
pd0wm | 0:bec310bde899 | 25 | rudder.pulsewidth(0.001 + stand / 100000.0); |
pd0wm | 0:bec310bde899 | 26 | } |
pd0wm | 0:bec310bde899 | 27 |