Thomas Milburn
/
FBRDash-tom
can't push chnages :(
Fork of FBRDash by
Embed:
(wiki syntax)
Show/hide line numbers
LEDS.cpp
00001 #include "mbed.h" 00002 #include "LEDS.h" 00003 00004 //Drive the rev LEDs 00005 00006 //Initialise PWM pins 00007 LEDS::LEDS(PwmOut _pins[]) 00008 { 00009 pins = _pins; 00010 00011 pins[0].period_us(100); 00012 } 00013 00014 //Calculate new PWM values 00015 void LEDS::refresh(float rpm) 00016 { 00017 00018 //Engine running 00019 pins[0]=(rpm-1000)/4000; 00020 //Change Down 00021 pins[1]=(rpm-5000)/2000; 00022 //Good gear 00023 pins[2]=(rpm-7000)/2000; 00024 pins[3]=(rpm-9000)/2000; 00025 //Change up 00026 pins[4]=(rpm-11000)/500; 00027 //Change up urgently 00028 pins[5]=(rpm-11500)/500; 00029 }
Generated on Wed Jul 13 2022 14:23:01 by 1.7.2