can't push chnages :(

Dependencies:   PinDetect TextLCD mbed

Fork of FBRDash by Michael Allan

src/LEDS.cpp

Committer:
intrinseca
Date:
2012-06-25
Revision:
1:b3907b8d9f65
Child:
2:825f572902c6

File content as of revision 1:b3907b8d9f65:

#include "mbed.h"
#include "LEDS.h"

LEDS::LEDS(PwmOut _pins[])
{
    pins = _pins;    
    
    pins[0].period_us(100);
}

void LEDS::refresh(float rpm)
{
    int value;
    int remainder;
    int i;
    
    value = rpm / RESOLUTION;
  
    for(i = 0; i < NUM_LEDS; i++)
    {          
        if(i < value)
        {                
            pins[i] = 1.0;
        }
        else if(i == value)
        {
            remainder = (int)rpm % RESOLUTION;
            pins[i] = (float)remainder / (float)RESOLUTION;
        }
        else
        {
            pins[i] = 0.0;
        }
    }
}