Introduction: LCD WITH BLUETOOTH

WELCOME BACK!!!!!! This is a funny ibles.where you can ask apology to your loved ones through arduino.really a funny one right???? let's get started with gathering the parts required for this ibles.

Step 1: HARDWARE REQUIRED:-

  • Arduino Uno
  • LCD Module (HD44780 compatible)
  • Potentiometer
  • Tilt Switch
  • 220 Ohm Resistor (Red-Red-Black-Black) / (Red-Red-Brown) or 470 Ohm or 560 Ohm is fine too

Step 2: CONSTRUCTION:-

Wire up the LCD module to the Arduino as listed below and illustrated in the Diagrams.Don't forget to wire in the Pot and the Tilt Switch too as shown.

WIre up the LCD Module as follows:

LCD pin (1) / Vss

Gnd LCD pin (2) / Vdd

5V LCD pin (4) / RS

12 LCD pin (5) / R/W

Gnd LCD pin (6) / E

11 LCD pin (11) / D4

5 LCD pin (12) / D5

4 LCD pin (13) / D6

3 LCD pin (14) / D7

2In addition you need to wire 5V/Gnd to the A/K of the backlight LED (pins 15/16); and wire in a potentiometer to adjust the contrast (pin 3).Without the contrast adjustment and the backlight the LCD will not Display anything visible.

Step 3: CODING:-

#include

#include

// 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 = 10;

// 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;

int i;

// Define your excuses char *start []= {"I'm sorry but ","Don't blame me ", "Not my fault ","Guess what happened "}; char *middle []= {"Godzilla ","Chuck Norris ", "Scrooge McDuck ","Soap McTavish"}; char *ends []= {"tried to kill me. ","ate my homework.","came after me.","stole my head."};

int length = 4;

void setup() { // set up the number of columns and rows on the LCD lcd.begin(16, 2); // Set the pullup on the switch pin pinMode(switchPin, INPUT); digitalWrite(switchPin, HIGH); }

void loop() { // clean up the screen before printing a new reply lcd.clear(); // Print a message to the LCD. lcd.print("Need an"); // set the cursor to column 0, line 1 // line 1 is the second row, since counting begins with 0 lcd.setCursor(0, 1); // print to the second line lcd.print("Excuse?");

for (i=0; i<4; i++) {

// loop until the switch has changed from LOW to HIGH while (!(switchState == HIGH && prevSwitchState == LOW)) { // the switch did not change from LOW to HIGH last time // Remember the previous switch state from the last iteration prevSwitchState = switchState; // Read the present state switchState = digitalRead(switchPin); // delay as a simple debounce delay(100); } // the while loop exited wthout updating // the previous switch state so do it now prevSwitchState = switchState;

if (switchState == HIGH) { // randomly choose a reply index reply = random(length); // clean up the screen before printing a new reply lcd.clear(); // set the cursor to column 0, line 0 lcd.setCursor(0, 0); // print some text // A different part of the excuse for each for-loop iteration switch(i) { case 0:lcd.print(start[reply]); break; case 1:lcd.print(middle[reply]); break; case 2:lcd.print(ends[reply]); break; } } } }