Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 7

// include the library code: #include <LiquidCrystal.

h> LiquidCrystallcd(12, 11, 5, 4, 3, 2); float T1,T2,T3,T4,T5; void setup() { // set up the LCD's number of columns and rows: lcd.begin(16, 2); } void loop(){ T1 = analogRead(A1); lcd.setCursor(0, 0); lcd.print("temp1 ="); T1 = (5.0 * T1 * 100.0)/1024.0; lcd.setCursor(7, 0); lcd.print((int)T1,DEC); lcd.print("C"); lcd.setCursor(12, 0); T2 = analogRead(A2); lcd.setCursor(0, 2); lcd.print("temp2 ="); T2 = (5.0 * T2 * 100.0)/1024.0; lcd.setCursor(7, 2);

lcd.print((int)T2,DEC); lcd.print("C"); lcd.setCursor(12, 0); delay(500); { // scroll 13 positions (string length) to the left // to move it offscreen left: for (intpositionCounter = 0; positionCounter< 13; positionCounter++) { // scroll one position left: lcd.scrollDisplayLeft(); // wait a bit: delay(1); }

// scroll 29 positions (string length + display length) to the right // to move it offscreen right: for (intpositionCounter = 0; positionCounter< 29; positionCounter++) { // scroll one position right: lcd.scrollDisplayRight(); // wait a bit: delay(1); }

// scroll 16 positions (display length + string length) to the left // to move it back to center: for (intpositionCounter = 0; positionCounter< 16; positionCounter++) { // scroll one position left: lcd.scrollDisplayLeft(); // wait a bit: delay(100); } // delay at the end of the full loop: delay(5000); } T3 = analogRead(A3); lcd.setCursor(0, 0); lcd.print("temp3 ="); T3 = (5.0 * T3 * 100.0)/1024.0; lcd.setCursor(7, 0); lcd.print((int)T3,DEC); lcd.print("C"); lcd.setCursor(12, 0); T4 = analogRead(A4); lcd.setCursor(0, 2); lcd.print("temp4 =");

T4 = (5.0 * T4 * 100.0)/1024.0; lcd.setCursor(7, 2); lcd.print((int)T4,DEC); lcd.print("C"); lcd.setCursor(12, 0); delay(500); { // scroll 13 positions (string length) to the left // to move it offscreen left: for (intpositionCounter = 0; positionCounter< 13; positionCounter++) { // scroll one position left: lcd.scrollDisplayLeft(); // wait a bit: delay(1); } // scroll 29 positions (string length + display length) to the right // to move it offscreen right: for (intpositionCounter = 0; positionCounter< 29; positionCounter++) { // scroll one position right: lcd.scrollDisplayRight(); // wait a bit: delay(1);

} // scroll 16 positions (display length + string length) to the left // to move it back to center: for (intpositionCounter = 0; positionCounter< 16; positionCounter++) { // scroll one position left: lcd.scrollDisplayLeft(); // wait a bit: delay(100); }

// delay at the end of the full loop: delay(5000); } T5 = analogRead(A5); lcd.setCursor(0, 0); lcd.print("temp5 ="); T5 = (5.0 * T5 * 100.0)/1024.0; lcd.setCursor(7, 0); lcd.print((int)T5,DEC); lcd.print("C"); lcd.setCursor(12, 0); lcd.setCursor(0, 2);

lcd.print("Kelompok 3"); delay(500); { // scroll 13 positions (string length) to the left // to move it offscreen left: for (intpositionCounter = 0; positionCounter< 13; positionCounter++) { // scroll one position left: lcd.scrollDisplayLeft(); // wait a bit: delay(1); } // scroll 29 positions (string length + display length) to the right // to move it offscreen right: for (intpositionCounter = 0; positionCounter< 29; positionCounter++) { // scroll one position right: lcd.scrollDisplayRight(); // wait a bit: delay(1); }

// scroll 16 positions (display length + string length) to the left

// to move it back to center: for (intpositionCounter = 0; positionCounter< 16; positionCounter++) { // scroll one position left: lcd.scrollDisplayLeft(); // wait a bit: delay(100); } // delay at the end of the full loop: delay(5000); } }

You might also like