![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
can't push chnages :(
Fork of FBRDash by
src/LEDS.cpp@5:177520d43c87, 2012-10-14 (annotated)
- Committer:
- tomontoast
- Date:
- Sun Oct 14 21:09:49 2012 +0000
- Revision:
- 5:177520d43c87
- Parent:
- 2:825f572902c6
14/10/12
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
intrinseca | 1:b3907b8d9f65 | 1 | #include "mbed.h" |
intrinseca | 1:b3907b8d9f65 | 2 | #include "LEDS.h" |
intrinseca | 1:b3907b8d9f65 | 3 | |
intrinseca | 2:825f572902c6 | 4 | //Drive the rev LEDs |
intrinseca | 2:825f572902c6 | 5 | |
intrinseca | 2:825f572902c6 | 6 | //Initialise PWM pins |
intrinseca | 1:b3907b8d9f65 | 7 | LEDS::LEDS(PwmOut _pins[]) |
intrinseca | 1:b3907b8d9f65 | 8 | { |
intrinseca | 1:b3907b8d9f65 | 9 | pins = _pins; |
intrinseca | 1:b3907b8d9f65 | 10 | |
intrinseca | 1:b3907b8d9f65 | 11 | pins[0].period_us(100); |
intrinseca | 1:b3907b8d9f65 | 12 | } |
intrinseca | 1:b3907b8d9f65 | 13 | |
intrinseca | 2:825f572902c6 | 14 | //Calculate new PWM values |
intrinseca | 1:b3907b8d9f65 | 15 | void LEDS::refresh(float rpm) |
intrinseca | 1:b3907b8d9f65 | 16 | { |
intrinseca | 1:b3907b8d9f65 | 17 | |
tomontoast | 5:177520d43c87 | 18 | //Engine running |
tomontoast | 5:177520d43c87 | 19 | pins[0]=(rpm-1000)/4000; |
tomontoast | 5:177520d43c87 | 20 | //Change Down |
tomontoast | 5:177520d43c87 | 21 | pins[1]=(rpm-5000)/2000; |
tomontoast | 5:177520d43c87 | 22 | //Good gear |
tomontoast | 5:177520d43c87 | 23 | pins[2]=(rpm-7000)/2000; |
tomontoast | 5:177520d43c87 | 24 | pins[3]=(rpm-9000)/2000; |
tomontoast | 5:177520d43c87 | 25 | //Change up |
tomontoast | 5:177520d43c87 | 26 | pins[4]=(rpm-11000)/500; |
tomontoast | 5:177520d43c87 | 27 | //Change up urgently |
tomontoast | 5:177520d43c87 | 28 | pins[5]=(rpm-11500)/500; |
intrinseca | 1:b3907b8d9f65 | 29 | } |