倒數計時


 //Compatible with the Arduino IDE 1.0

//Library version:1.1

#include <LiquidCrystal_I2C.h>


LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 16 chars and 2 line display


void setup()

{

  lcd.init();                      // initialize the lcd 

  // Print a message to the LCD.

  lcd.backlight();

  lcd.setCursor(3,0);

 

}



void loop()

{

  for (int i = 1000; i >= 0; i--) {

    // Clear the display

    lcd.clear();

    

    // Print countdown value

    lcd.home();

    lcd.print(i);


    // Delay for 1 second

    delay(1000);

}

}

留言