Skip to content
This repository has been archived by the owner on Oct 24, 2019. It is now read-only.

Commit

Permalink
Compiles but don't display anything yet
Browse files Browse the repository at this point in the history
  • Loading branch information
reefab committed Mar 3, 2013
1 parent 1aef2b4 commit cf4b611
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
20 changes: 14 additions & 6 deletions src/lcd.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
#include "Arduino.h"
#include "lcd.h"

#include "LiquidCrystal.h"

#include <LiquidCrystal.h>
LiquidCrystal lcdlib(4, 5, 6, 7, 8, 9);

Lcd::Lcd(int blPin) {
// LCD Init
lcdlib.begin(16, 2);
lcdlib.clear();

_blPin = blPin;
pinMode(_blPin, OUTPUT);
switchBacklight(true);
lcdlib.begin(16, 2);
}

void Lcd::clear() {
Expand All @@ -21,12 +17,24 @@ void Lcd::clear() {

void Lcd::setFirstLine(String str) {
firstLine = restrictIn16Chars(str);
lcdlib.clear();
lcdlib.print(firstLine);
}

// void Lcd::setFirstLine(__FlashStringHelper* data) {
// }

void Lcd::setSecondLine(String str) {
secondLine = restrictIn16Chars(str);
lcdlib.clear();
lcdlib.print(firstLine);
lcdlib.setCursor(0, 1);
lcdlib.print(secondLine);
}

// void Lcd::setSecondLine(__FlashStringHelper* data) {
// }

void Lcd::switchBacklight(boolean bl) {
if (bl) {
digitalWrite(_blPin, HIGH);
Expand Down
2 changes: 2 additions & 0 deletions src/lcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class Lcd
Lcd(int blPin);
void setFirstLine(String str);
void setSecondLine(String str);
// void setFirstLine(__FlashStringHelper* str);
// void setSecondLine(__FlashStringHelper* str);
void switchBacklight(boolean bl);
void clear();

Expand Down
5 changes: 3 additions & 2 deletions src/sketch.ino
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@ float currentSpeed = 0;
boolean done = false;
boolean uploaded = false;

#define lcdblPin 3 // LCD backlight
#include "Lcd.h"
// LCD backlight
#define lcdblPin 3
Lcd Lcd(lcdblPin);

#include "display.h"
Expand All @@ -108,6 +107,8 @@ void setup() {

pinMode(reedPin, INPUT);

pinMode(lcdblPin, OUTPUT);
Lcd.switchBacklight(true);
Lcd.setFirstLine(msg_start);

// start Ethernet
Expand Down

0 comments on commit cf4b611

Please sign in to comment.