Wednesday, June 7, 2017

Testing Arduino...

This is an easy assembly from a Arduino Uno kit, trying out the code just for fun and see how the system works. Mostly because I hadn't tried it before.

Basically connect like this:



/*
*
*
*/
#include <LiquidCrystal.h> // includes the LiquidCrystal Library
LiquidCrystal lcd(7, 8, 9, 10, 11, 12); // Creates an LC object. Parameters: (rs, enable, d4, d5, d6, d7)

int backLight = 13; // set pin 13 to control the backlight;

void setup() {
  // put your setup code here, to run once:

 lcd.begin(16,2); // Initializes the interface to the LCD screen, and specifies the dimensions (width and height) of the display }
 lcd.print("hello, world!");

 pinMode (backLight, OUTPUT);

digitalWrite(backLight,HIGH);

lcd.clear();

lcd.begin(16,2);

lcd.setCursor(0,0);

lcd.print("Hello, World"); // can change any words you want;

lcd.setCursor(0,1);

lcd.print("I feel good!"); // can change any words you want;

}

void loop() {
  // put your main code here, to run repeatedly:

 delay(3000);
 lcd.clear(); // Clears the display

 lcd.print("Arduino"); // Prints "Arduino" on the LCD
 delay(3000); // 3 seconds delay
 lcd.setCursor(2,1); // Sets the location at which subsequent text written to the LCD will be displayed
 lcd.print("Makes magic");
 delay(3000);
 lcd.clear(); // Clears the display
 lcd.blink(); //Displays the blinking LCD cursor
 delay(4000);
 lcd.setCursor(7,1);
 delay(3000);
 lcd.noBlink(); // Turns off the blinking LCD cursor
 lcd.cursor(); // Displays an underscore (line) at the position to which the next character will be written
 delay(4000);
 lcd.noCursor(); // Hides the LCD cursor
 lcd.clear(); // Clears the LCD screen

 }

I did not clean up this code, so use it for what it is, just a test! 

No comments:

Post a Comment