Willem Melching
/
bootje_v4
other/pws.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 "pws.h" |
pd0wm | 0:bec310bde899 | 2 | |
pd0wm | 0:bec310bde899 | 3 | double verschil(double van, double naar){ |
pd0wm | 0:bec310bde899 | 4 | double error = naar - van; |
pd0wm | 0:bec310bde899 | 5 | |
pd0wm | 0:bec310bde899 | 6 | if (error > 180) |
pd0wm | 0:bec310bde899 | 7 | error -= 360; |
pd0wm | 0:bec310bde899 | 8 | if (error < -180) |
pd0wm | 0:bec310bde899 | 9 | error += 360; |
pd0wm | 0:bec310bde899 | 10 | |
pd0wm | 0:bec310bde899 | 11 | return error; |
pd0wm | 0:bec310bde899 | 12 | } |