sci-oly-detector-building

[RADIOACTIVE] arduino thermometer for science olympiad
git clone git://git.figbert.com/sci-oly-detector-building.git
Log | Files | Refs | LICENSE

SunFounderLCDTest.ino (1906B)


      1 /********************************
      2 * name:I2C LCD1602
      3 * function:You should now see your I2C LCD1602 display the flowing characters: "SunFounder" and "hello, world".
      4 ********************************/
      5 //Email:support@sunfounder.com
      6 //Website:www.sunfounder.com
      7 
      8 /********************************/
      9 // include the library code
     10 #include <Wire.h> 
     11 #include <LiquidCrystal_I2C.h>
     12 /**********************************************************/
     13 char array1[]=" SunFounder               "; //the string to print on the LCD
     14 char array2[]="hello, world!               "; //the string to print on the LCD
     15 int tim = 500; //the value of delay time
     16 // initialize the library with the numbers of the interface pins
     17 LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
     18 /*********************************************************/
     19 void setup()
     20 {
     21   lcd.init(); //initialize the lcd
     22   lcd.backlight(); //open the backlight 
     23 }
     24 /*********************************************************/
     25 void loop() 
     26 {
     27   lcd.setCursor(15,0); // set the cursor to column 15, line 0
     28   for (int positionCounter1 = 0; positionCounter1 < 26; positionCounter1++)
     29   {
     30     lcd.scrollDisplayLeft(); //Scrolls the contents of the display one space to the left.
     31     lcd.print(array1[positionCounter1]); // Print a message to the LCD.
     32     delay(tim); //wait for 250 microseconds
     33   }
     34   lcd.clear(); //Clears the LCD screen and positions the cursor in the upper-left  corner.
     35   lcd.setCursor(15,1); // set the cursor to column 15, line 1
     36   for (int positionCounter = 0; positionCounter < 26; positionCounter++)
     37   {
     38     lcd.scrollDisplayLeft(); //Scrolls the contents of the display one space to the left.
     39     lcd.print(array2[positionCounter]); // Print a message to the LCD.
     40     delay(tim); //wait for 250 microseconds
     41   }
     42   lcd.clear(); //Clears the LCD screen and positions the cursor in the upper-left corner.
     43 }