![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
uitvoer/zeil.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 "zeil.h" |
pd0wm | 0:bec310bde899 | 2 | |
pd0wm | 0:bec310bde899 | 3 | Zeil::Zeil() : led(LED3),sail(p22) { |
pd0wm | 0:bec310bde899 | 4 | |
pd0wm | 0:bec310bde899 | 5 | stand = 50; |
pd0wm | 0:bec310bde899 | 6 | this->write(); |
pd0wm | 0:bec310bde899 | 7 | } |
pd0wm | 0:bec310bde899 | 8 | |
pd0wm | 0:bec310bde899 | 9 | void Zeil::set(int s) { |
pd0wm | 0:bec310bde899 | 10 | stand = s; |
pd0wm | 0:bec310bde899 | 11 | |
pd0wm | 0:bec310bde899 | 12 | if (stand > 100) |
pd0wm | 0:bec310bde899 | 13 | stand = 100; |
pd0wm | 0:bec310bde899 | 14 | if (stand < 0) |
pd0wm | 0:bec310bde899 | 15 | stand = 0; |
pd0wm | 0:bec310bde899 | 16 | |
pd0wm | 0:bec310bde899 | 17 | this->write(); |
pd0wm | 0:bec310bde899 | 18 | |
pd0wm | 0:bec310bde899 | 19 | |
pd0wm | 0:bec310bde899 | 20 | } |
pd0wm | 0:bec310bde899 | 21 | |
pd0wm | 0:bec310bde899 | 22 | |
pd0wm | 0:bec310bde899 | 23 | |
pd0wm | 0:bec310bde899 | 24 | |
pd0wm | 0:bec310bde899 | 25 | int Zeil::get(void) { |
pd0wm | 0:bec310bde899 | 26 | return stand; |
pd0wm | 0:bec310bde899 | 27 | } |
pd0wm | 0:bec310bde899 | 28 | |
pd0wm | 0:bec310bde899 | 29 | void Zeil::write(void){ |
pd0wm | 0:bec310bde899 | 30 | led = stand / 100.0; |
pd0wm | 0:bec310bde899 | 31 | sail.pulsewidth(0.001 + stand / 100000.0); |
pd0wm | 0:bec310bde899 | 32 | } |
pd0wm | 0:bec310bde899 | 33 | |
pd0wm | 0:bec310bde899 | 34 | |
pd0wm | 0:bec310bde899 | 35 |