private void leds_Click(object sender, EventArgs e) { LEDControl led = sender as LEDControl; led.On = !led.On; if (led.Name.Equals(LED_NAME_SUFFIX + 9)) { led.IsBlink = isDance = led.On; ToggleOnOff(false); timerDance.Enabled = led.On; //data = 0; } else if (led.Name.Equals(LED_NAME_SUFFIX + 10)) { data = (led.On) ? 255 : 0; ToggleOnOff(led.On); } else { tagInt = Convert.ToInt32(led.Tag); int power = (int)Math.Pow(2, tagInt); if (led.On) { data += power; } else { data -= power; } } PortControl.Output(PORT_ADDRESS, data); ShowData(data); }
private void timerDance_Tick(object sender, EventArgs e) { if (danceIndex < 9) { data = danceData[danceIndex]; PortControl.Output(PORT_ADDRESS, data); danceIndex += 1; } else { data = 0; danceIndex = 0; } ShowData(data); }