Browse files

add delay to storage write, change to use liquid crystal library, and…

… rewire button
  • Loading branch information...
1 parent 7937a3a commit 812e89e4990c82fdc6977239069f9287f8e3ade4 @sweemeng committed Apr 30, 2011
Showing with 12 additions and 8 deletions.
  1. +1 −1 libraries/storyboard/WordStorage.cpp
  2. +11 −7 storybox/storybox.pde
View
2 libraries/storyboard/WordStorage.cpp
@@ -18,7 +18,7 @@ void WordStorage::write(unsigned int eeaddress,int data){
Wire.send((int)(eeaddress & 0xFF)); // LSB
Wire.send(rdata);
Wire.endTransmission();
- delay(10);
+ delay(100);
}
int WordStorage::read_int(unsigned int eeaddress){
View
18 storybox/storybox.pde
@@ -1,4 +1,4 @@
-#include <LCD4Bit_mod.h>
+#include <LiquidCrystal.h>
#include <Wire.h>
#include <WordStorage.h>
@@ -11,7 +11,7 @@
#define buzzer 10
#define statusLed 13
-LCD4Bit_mod lcd = LCD4Bit_mod(2);
+LiquidCrystal lcd(12,11,7,6,5,4);
Bounce bouncer = Bounce(button1,50);
WordGenerator generator(7);
@@ -20,15 +20,15 @@ char *s_word;
void setup() {
pinMode(13, OUTPUT); //we'll use the debug LED to output a heartbeat
- lcd.init();
- lcd.clear();
+ lcd.begin(16,2);
randomSeed(analogRead(0));
Serial.begin(9600);
-
+ lcd.print("ping");
pinMode(statusLed,OUTPUT);
pinMode(buzzer,OUTPUT);
pinMode(button1,INPUT);
pinMode(lcdBacklit,OUTPUT);
+ digitalWrite(lcdBacklit,HIGH);
}
void loop(){
@@ -37,8 +37,10 @@ void loop(){
int value = bouncer.read();
data_load();
+
//analogWrite(lcdBacklit,15);
if(value == HIGH){
+ Serial.print('ping');
lcd.clear();
int segment = TrueRandom.random(0,7);
digitalWrite(statusLed,HIGH);
@@ -56,7 +58,7 @@ void loop(){
int l_cursor = 0;
for(int i = s_start+1;i<s_end;i++){
- lcd.cursorTo(1,l_cursor);
+ lcd.setCursor(l_cursor,0);
char letter = generator.get_storage(i);
lcd.print(letter);
Serial.write(letter);
@@ -88,5 +90,7 @@ void data_load(){
}
}
generator.put_storage(0,0);
-
+ for(int i=0;i<storage_size;i++){
+ Serial.print(generator.get_storage(i));
+ }
}

0 comments on commit 812e89e

Please sign in to comment.