2013年6月10日 星期一

[Arduino] Display word on the liquid crystal


[Arduino] Display word on the liquid crystal



This code can type word, then show the word on the liquid crystal.



##################################





##################################





 



##################################

#include <LiquidCrystal.h>



LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);



void setup()

{

  Serial.begin(9600);

  lcd.begin(2,20);

  lcd.clear();

  lcd.setCursor(0,0);

  lcd.print("Hello World");

  lcd.setCursor(0,1);

  lcd.print("Freeman");

}



void loop()

{

  if(Serial.available())

  {

      char ch = Serial.read();

      if(ch == '#')

      {

        lcd.clear();

      }

      else if(ch == '/')

      {

        lcd.setCursor(0,1);

      }

      else

      {

        lcd.write(ch);

      }

  }

}



##################################


Related Posts:

0 意見:

張貼留言