示例#1
0
void _isr_timer() {
	// Flash the red LED
	if (red_flash_count) {
		if (red_flash_count & 1) {
			WRITE_LOW(&PORTD, RED_LED_PIN);
		} else {
			WRITE_HIGH(&PORTD, RED_LED_PIN);
		}

		red_flash_count--;
	}

	// Flash the green LED
	if (green_flash_count) {
		if (green_flash_count & 1) {
			WRITE_LOW(&PORTD, GREEN_LED_PIN);
		} else {
			WRITE_HIGH(&PORTD, GREEN_LED_PIN);
		}

		green_flash_count--;
	}

	if (!green_flash_count && !red_flash_count) {
		//Disable timer
	}
}
示例#2
0
void init_leds() {
	// Turn off the leds
	WRITE_LOW(&PORTD, RED_LED_PIN);
	WRITE_LOW(&PORTD, GREEN_LED_PIN);

	// Set the pins to output
	DDRD |= (1 << GREEN_LED_PIN);
	DDRD |= (1 << RED_LED_PIN);

	// Clear the flash codes
	red_flash_count   = 0;
	green_flash_count = 0;

	// Set up the timer for the leds
}
示例#3
0
void ServoTINAH::detach()
{
    if (servo[this->channel].enabled)
    {
        WRITE_LOW(this->channel);
        servo[this->channel].angle = 0;
        servo[this->channel].enabled = false;
    }
}