Added Sate output

This commit is contained in:
IMback
2017-11-05 17:37:21 +01:00
parent b4d1844b68
commit 21b636aa98
48 changed files with 1363 additions and 3742 deletions

View File

@ -90,12 +90,14 @@ void RgbLed::setPattern(const uint8_t id)
void RgbLed::on()
{
_powerd = true;
_pwmA->on();
_pwmB->on();
}
void RgbLed::off()
{
_powerd = false;
_pwmA->off();
_pwmB->off();
}
@ -117,7 +119,7 @@ void RgbLed::patternStep()
_pwmA->setDutyA(255-_counter);
_pwmB->setDutyB(_counter-64);
}
else if(_pattern == 2)
else if(_pattern == 2) //Alarm!
{
if(!_stroke)_counter++;
else _counter --;
@ -137,16 +139,16 @@ void RgbLed::patternStep()
_pwmA->setDutyA(_counter >> 8);
_pwmB->setDutyB(_counter >> 3);
}
else if(_pattern == 4)
else if(_pattern == 4) //Sunrise
{
( _counter < 8192 ) ? _pwmA->setDutyB(_counter >> 6) : _pwmA->setDutyB( 128 + (_counter >> 11));
if( _counter > 1024 ) ( 8192 < _counter < 16384 ) ? _pwmA->setDutyA(_counter-8192 >> 6) : _pwmA->setDutyA( 128 + (_counter >> 9 ));
if( _counter > 8192 ) _pwmB->setDutyB(_counter >> 9);
( _counter < 8192 ) ? _pwmA->setDutyB(_counter >> 6) : _pwmA->setDutyB( 128 + (_counter >> 11));
if( _counter > 8192 ) ( _counter < 16384 ) ? _pwmA->setDutyA((_counter-8192) >> 6) : _pwmA->setDutyA( 128 + (_counter >> 9 ));
if( _counter > 16384 ) _pwmB->setDutyB((_counter >> 14)*20);
if(_counter<65530) _counter++;
else _pwmB->setDutyB(140);
if( _counter < 65535 ) _counter++;
//else _pwmB->setDutyB(140);
_delay_ms(18); //honey dose this make me look slow?
//_delay_ms(18); //honey dose this make me look slow?
}
}