Exemple #1
0
void loop(void)
{


//check for pressed key
    keyboardCheck();


//loop among screens
    if(screenActive==_screenMenu) screenActive=screenMenu();
    if(screenActive==_screenPlay) screenActive=screenPlay();
    if(screenActive==_screenEnd) screenActive=screenEnd();



//play sound
    if (millis() > songTime)
    {
        if (play_rtttl() == 1)//end of sound???
        {
            songIndex = 0; //restart tone from the begin
            songTime=millis()+600;//pause before next tone
        }
    }



}
Exemple #2
0
int main() {
    TIL311 = 0x01;
    
    default_interrupts();
    
    serial_start(SERIAL_SAFE);
    millis_start();

	lcd_init();
	lcd_puts("Hello from C,\non the 68008!");

    beep(700,250);
    DELAY_MS(50);
 	beep(500,300);
  	DELAY_MS(100);
  	beep(700,500);
  	DELAY_MS(500);
  	
  	play_rtttl(songs[0]);
   
    while(true) {
        TIL311 = 0xCC;
        DELAY_MS(1000);

        TIL311 = 0xC0;
        DELAY_MS(1000);
        
        TIL311 = 0xDE;
        DELAY_MS(1000);
        
        TIL311 = 0x00;
        DELAY_MS(1000);
               
        if(serial_available()) {
			int16_t ch;
			lcd_clear();
			uint8_t c = 0;
			
			while ((ch = getc()) != -1) {
				putc(ch);
				lcd_data(ch);
				if (c++ == 15)
					lcd_cursor(0,1);
			}
        } else {
        	lcd_clear();
        	lcd_puts("Time since boot:");
        	lcd_cursor(0,1);
        	lcd_printf("%3d.%02d seconds",millis()/1000, (millis()%1000)/10);
        }
    }
}
Exemple #3
0
void loop(void)
{
  unsigned long ulNow = millis();

  if (ulNow > displayRefresh)
  {
    //time to refresh the screen?
    displayRefresh = ulNow + 50;
    displayCopyToLed();
  }

  //play sound
  if (ulNow > songTime)
  {
    //time to play next note?
    if (play_rtttl() == 1)//end of sound???
    {
      songIndex = 0; //restart tone from the begin
      songTime = ulNow + 1000; //pause before next tone
    }
  }

  //check for pressed key
  keyboardCheck();


  //loop among screens
  switch (screenActive)
  {
    case _screenMenu: screenActive = screenMenu();
      break;
    case _screenPlay: screenActive = screenPlay();
      break;
    case _screenEnd:  screenActive = screenEnd();
      break;
  }


}