Vanemate ringitund 22.03.17

ARDUINO

LCD ekraani ühendamine:

LCD ekraanil teksti väljastamise kood:

// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
// set up a constant for the tilt switchPin
const int switchPin = 6;
// variable to hold the value of the switchPin
int switchState = 0;
// variable to hold previous value of the switchpin
int prevSwitchState = 0;
// a variable to choose which reply from the crystal ball
int reply;
void setup() {
  Serial.begin(9600);
  // set up the number of columns and rows on the LCD
  lcd.begin(16, 2);
}
void loop() {
  lcd.clear();
  lcd.setCursor(0, 0);
      // print some text
      lcd.print(“Fluffy aka Litulu “);
      // move the cursor to the second line
      lcd.setCursor(0, 1);
    lcd.print(“Richardo-kun”);
    delay(3000);
      lcd.clear();
      lcd.setCursor(0, 0);
      // print some text
      lcd.print(“Taugrom aka”);
      // move the cursor to the second line
      lcd.setCursor(0, 1);
    lcd.print(“Lil tau”);
    delay(3000);
}

 

Codebug muusika ja Arduino koos