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: mbed TextLCD PinDetect
src/LEDS.cpp
- Committer:
- tomontoast
- Date:
- 2012-10-14
- Revision:
- 5:177520d43c87
- Parent:
- 2:825f572902c6
- Child:
- 7:78cb2263290a
File content as of revision 5:177520d43c87:
#include "mbed.h"
#include "LEDS.h"
//Drive the rev LEDs
//Initialise PWM pins
LEDS::LEDS(PwmOut _pins[])
{
pins = _pins;
pins[0].period_us(100);
}
//Calculate new PWM values
void LEDS::refresh(float rpm)
{
//Engine running
pins[0]=(rpm-1000)/4000;
//Change Down
pins[1]=(rpm-5000)/2000;
//Good gear
pins[2]=(rpm-7000)/2000;
pins[3]=(rpm-9000)/2000;
//Change up
pins[4]=(rpm-11000)/500;
//Change up urgently
pins[5]=(rpm-11500)/500;
}
