Read the first part! Write up coming soon! The schematic is created using Fritzing. Download Fritzing and open this file to view the circuit. ![]() Codes // Global area #include "LCD4884.h" // Add library & related includes file here #include <WProgram.h> #include <Wire.h> #include <DS1307.h> const float MULTIPLIER = 0.48828; // Initialization that run on // powerup or after reset void setup(){ // Add code to initialize the RTC lib here RTC.stop(); RTC.set(DS1307_SEC,1); //set the seconds RTC.set(DS1307_MIN,23); //set the minutes RTC.set(DS1307_HR,12); //set the hours RTC.set(DS1307_DATE,5); //set the date RTC.set(DS1307_MTH,3); //set the month RTC.set(DS1307_YR,9); //set the year RTC.start(); lcd.LCD_init(); lcd.LCD_clear(); lcd.LCD_write_string( 8, 0, "Homebrew &", MENU_NORMAL ); lcd.LCD_write_string( 7, 1, "Technology", MENU_NORMAL ); lcd.LCD_write_string(14, 2, "presents", MENU_NORMAL ); lcd.LCD_write_string(16, 3, "Graphic", MENU_NORMAL ); lcd.LCD_write_string(13, 4, "LCD 4884", MENU_NORMAL ); lcd.LCD_write_string(16, 5, "Shield", MENU_NORMAL ); lcdBlink(3, 2000); } // After setup is completed this part // of code will repeat until device off void loop(){ lcd.LCD_clear(); int raw = analogRead(2); int temp = MULTIPLIER * (float) raw; char tempString[6] = ""; sprintf(tempString,"+%d",temp); lcd.LCD_write_string_big( 15, 1, tempString, MENU_NORMAL); lcd.LCD_write_string( 55, 2, "C", MENU_NORMAL); // Add code to get current time and display here int hour = RTC.get(DS1307_HR,true); int mins = RTC.get(DS1307_MIN,false); int second =RTC.get(DS1307_SEC,false); sprintf(tempString,"%02d:%02d:%02d", hour, mins,second); lcd.LCD_write_string(0, 0, tempString, MENU_NORMAL); delay(2000); } void lcdBlink(int count, int delayMs){ for(int i=0; i< count; i++){ lcd.LCD_backlight(1); delay(delayMs); lcd.LCD_backlight(0); delay(delayMs); } lcd.LCD_backlight(1); } |
Arduino > Brewing Arduino >