示例#1
0
文件: leds.c 项目: BASM/super-clock
int main(void)
{
    wdt_disable();
    cli();

    DDRD=0xFE;
    DDRB=0xFf;
    uart_init();
    uart_stdio();
    str(1);

    unsigned char num=0;
    for(;;){    /* main event loop */

      putnum(num++);
      if(num > 12) num = 0;
      str(0);
      wait();
      str(1);
      wait();
      str(0);

      //printf("Hello world\r\n");
      _delay_ms(200);
    }
    return 0;
}
示例#2
0
文件: main.c 项目: BASM/super-clock
int main(void)
{
    wdt_disable();
    cli();

    DDRC=0xFE;

    DDRD=0xFA;//P2 input
    PORTD=0xFF;//pullup
    DDRB=0xFf;
    uart_init();
    uart_stdio();

    ///set time
    char buff[10];
    strcpy(buff, __TIME__);
    buff[2]='\0';
    buff[5]='\0';

    hour=atoi(&buff[0]);
    min=atoi(&buff[3]);
    sec=atoi(&buff[6]);

    timer2();
    sei();
    int m=0;
    /////EXTERNAL LIBS INIT

    ir_init();

    ////////////////////////
    for(;;){    /* main event loop */

    leds_put(hour/10,m);
    leds_put(hour%10,m);
    leds_put(min/10,m);
    leds_put(min%10,m);
    leds_put(sec/10,m);
    leds_put(sec%10,m);
    leds_strobe();
    _delay_ms(1);

    leds_put(17,m);
    leds_put(17,m);
    leds_put(17,m);
    leds_put(17,m);
    leds_put(17,m);
    leds_put(17,m);
    leds_put(17,m);
    leds_strobe();

    _delay_ms(10);
    }
    return 0;
}
示例#3
0
文件: main.c 项目: FyiurAmron/avr
int main( void ) {
    init();

    uart_init();
    uart_stdio();
    printf( "\n\rUART device started: %ld %ld %d\n\r", UBRRH_VALUE, UBRRL_VALUE, USE_2X );

    DDRB  |= BV(PB4);

    for(;;) {
        PORTB = 0x00;
        PORTB = 0xFF;
    }
} // main()