I spent some hours in playing with the Nokia LCD and some input devices, so I wanted to share that funny thing.
What you need:
- Breadboard
- Arduino (I used a nano)
- Nokia 3310 LCD
- DS1307 RTC
- 10kOhm poti
- Photoresistor and a 620ohm Resi.
- Some jumper wires
Attach all components like described in the links in the code or Arduino Playground and you should get this funny stuff working well.
/* Playing with Nokia LCD 3310 by ReDiculum Jan. 2014
Use at your own risk
*/
//https://code.google.com/p/pcd8544/
#include <PCD8544.h>
//https://github.com/davidhbrown/RealTimeClockDS1307
#include <Wire.h>
#include <RealTimeClockDS1307.h>
static PCD8544 lcd;
void setup() {
lcd.begin(84, 48);
}
void loop() {
// Potentiometer on A3
lcd.setCursor(0,0); lcd.clearLine();
int potValue = map(analogRead(3),0,1023,0,100);
lcd.print("Poti: ");
lcd.print(potValue);
lcd.print("% ");
drawBar(0, map(potValue,0,100,403,420));
// Phototransistor on A6
lcd.setCursor(0,2); lcd.clearLine();
int phoValue = map(analogRead(6),0,1023,100,0);
lcd.print("Phot: ");
lcd.print(phoValue);
lcd.print("% ");
drawBar(2, map(phoValue,0,100,403,420));
// RealTimeClock on A4+5
lcd.setCursor(0,4); lcd.clearLine();
lcd.print("Time: ");
RTC.readClock();
lcd.print(RTC.getHours()); lcd.print(":");
lcd.print(RTC.getMinutes()); lcd.print(":");
lcd.print(RTC.getSeconds());
}
void drawBar(int line, int val) {
for (int i = 403; i <= val; i++) {
lcd.setCursor(i,line);
lcd.drawColumn(0,8);
}
}
Poti playing
Photoresi playing