case 0b00100000:
mode = 6;
rpmmax=rpmmax-250;
module.setDisplayToDecNumber( rpmmax, 0, false );
mode = 2;
break;
case 0b01000000:
mode = 7;
rpmmax=rpmmax+250;
module.setDisplayToDecNumber( rpmmax, 0, false );
mode = 2;
break;
if ( mode == 8 )
{
module.setDisplayToDecNumber( rpmmax, 0, false );
if ( rpmlast > ( rpmmax + 200 ) )
{
rpmmax = rpmlast;
}
mode = 2;
}
rpmleds = map(rpm,rpmmax*0.75,rpmmax,0,10); // distributes the rpm level to the 8 leds + 1 for shift change
if ( rpmleds==1 ) {
module.setLEDs( 0b00000000 | 0b00000000 << 8);
}
if ( rpmleds==2 ) {
module.setLEDs( 0b00000001 | 0b00000000 << 8 );
}
if ( rpmleds==3 ) {
module.setLEDs( 0b00000011 | 0b00000000 << 8 );
}
if ( rpmleds==4 ) {
module.setLEDs( 0b00000111 | 0b00000000 << 8 );
}
if ( rpmleds==5 ) {
module.setLEDs( 0b00001111 | 0b00000000 << 8 );
}
if ( rpmleds==6 ) {
module.setLEDs( 0b00011111 | 0b00000000 << 8 );
}
if ( rpmleds==7 ) {
module.setLEDs( 0b00111111 | 0b00000000 << 8 );
}
if ( rpmleds==8 ) {
module.setLEDs( 0b01111111 | 0b00000000 << 8 );
}
if ( rpmleds==9 ) {
module.setLEDs( 0b00000000 | 0b11111111 << 8 );
}
if ( rpmleds==10 ) {
module.setLEDs( 0b00000000 | 0b11111111 << 8 );
delay ( 20 );
module.setLEDs( 0b00000000 | 0b00000000 << 8 );
delay ( 20 );
}
}
rpmlast = rpm;
Users browsing this forum: No registered users and 1 guest