top of page
Check back soon
Once posts are published, you’ll see them here.

Arduino lcd + LED

  • May 9, 2017
  • 1 min read

#include <Wire.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27, 16, 2);

int ledPinR = 13;//red int ledPinY = 12;//yellow int ledPinG = 11;//green

void setup() { // initialize digital pin 13 as an output. pinMode(ledPinR, OUTPUT); pinMode(ledPinY, OUTPUT); pinMode(ledPinG, OUTPUT);

//lcd lcd.init(); lcd.backlight(); }

// the loop function runs over and over again forever void loop() {

for (int i = 15; i >= 0; i--) { lcd.clear(); lcd.print("Remaining Time:"); lcd.setCursor(9, 1); lcd.print("Seconds"); lcd.setCursor(5, 1); lcd.print(i); if (i == 5 || i == 3 || i == 1 || i == 0) { digitalWrite(ledPinG, LOW); } else { digitalWrite(ledPinG, HIGH); } delay(1000); }

for (int i = 2; i >= 0; i--) { digitalWrite(ledPinY, HIGH); lcd.clear(); lcd.print("Remaining Time:"); lcd.setCursor(9, 1); lcd.print("Seconds"); lcd.setCursor(5, 1); lcd.print(i); if (i == 0) { digitalWrite(ledPinY, LOW); } delay(1000); }

for (int i = 5; i >= 0; i--) { digitalWrite(ledPinR, HIGH); lcd.clear(); lcd.print("Remaining Time:"); lcd.setCursor(9, 1); lcd.print("Seconds"); lcd.setCursor(5, 1); lcd.print(i); if (i == 0) { digitalWrite(ledPinR, LOW); } delay(1000); }

}


 
 
 

Comments


join us

 for the 

PARTY

Recipe Exchange @ 9pm!

start

 with 

Ubuntu

ubuntu   12.04

Linux 桌面系統
心得與筆記
  • 課程:Linux桌面系統

  • 系級:資管二甲

  • 姓名:蘇亭云

  • 學號:403401263.

Read More About me
Tag Cloud
Follow Me
  • Facebook - White Circle
  • Twitter - White Circle
  • Google+ - White Circle
  • YouTube - White Circle
  • Instagram - White Circle

© 2023 by My Weight Lost Journey. Proudly Created with Wix.com

bottom of page