Der SystemTick mit dem myAVR MK3

Controller::onTimer10ms()
// system tick event from kernel
speaker.toggle();
Controller::onEvent100ms()
// 100 millisecond event from kernel
redLED.toggle();
Controller::onEvent1s()
// 1 second event from kernel
greenLED.toggle();
Controller::onWork()
// continuous event from the Mainloop
static uint16_t dim=0;
dim++;
if (dim < 1000)
{
	yellowLED.on();
	for (int16_t i=0; i<dim; i++)
		waitUs(1);
	yellowLED.off();
	for (int16_t i=dim; i<1000; i++)
		waitUs(1);
}
else if(dim <2000)
{
	yellowLED.on();
	for (int16_t i=dim; i<2000; i++)
		waitUs(1);
	yellowLED.off();
	for (int16_t i=1000; i<dim; i++)
		waitUs(1);
}
else
{
	dim=0;
}

Videozusammenfassung

Weiter mit

  • mk3_systemtickuml.txt
  • Zuletzt geändert: 2022/03/11 12:07
  • von huwi