In: Electrical Engineering
Constant Current Code for Arduino
Develop a Constant Current Program in C and upload it into your Arduino
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
For connecting the LCD to arduino following are the instructions:
1. Connect PIN1 or VSS to ground, PIN2, VCC to +5v power, PIN3/VEE to ground, PIN4/Register Selection to PIN0 of ARDUINO UNO, PIN5/RW to ground, PIN6/Enable) to PIN1 of ARDUINO UNO, PIN11/D4 to PIN8 of ARDUINO UNO, PIN12/D5 to PIN9 of ARDUINO UNO, PIN13/D6 to PIN10 of ARDUINO UNO, PIN14/D7 to PIN11 of ARDUINO UNO
After connnecting all the points we have write the C programme and burn it on the IC using burner for auduino.
The LCD interfacing will be 16X2 and the programme to print "my name is ABC" on LCD will be
#include <LiquidCrystal.h>
lcd.begin(16, 2);
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
lcd.print("my name is abc");
C code porgramme:
#include <LiquidCrystal.h>
// initialize the programme with the numbers of pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); /// select register pin, enabe D4 pin, d7 pin and d6 pin
void setup()
{
// Set up LCD's number of columns and rows:
lcd.begin(16, 2);
}
void loop()
{
// set cursor to column 0, line 1
lcd.print(" my name is abc");//print name
lcd.setCursor(0, 1); // set cursor to column 0, line 2
lcd.print("what do you do");//print name
delay(800);//delay of 0.8sec
lcd.scrolldisplayLeft(); //shifting data on LCD
lcd.setcursor(0, 0); // set the cursor to column 0, line1
}
The following would be the ouput
my name is abc
what do you do
_