Digistump Forums
The Digispark => Digispark (Original) Support => Topic started by: atrueresistance on January 25, 2013, 11:17:15 am
-
Hello I have the model A board digispark (rev b present) and am struggling to get an LCD module running with it. Programming wise I use the basic sketch digistump provided.
This is the module and controller http://www.ebay.com/itm/160943085721?redirect=mobile (http://www.ebay.com/itm/160943085721?redirect=mobile)
My wiring as follows
- Digi - LCD
- P0 (SDA) - (4.7k ohm) - SDA
- 5v - VIN
- P2 (SCK) - (4.7k ohm) - SCL
- GND - GND
This is all wired to a bread board. I took about 2ft of Ethernet cable and soldiered to a cut 4 pin female pin set to easily connect/disconnect the display.
Here are some photos of my wiring
http://imgur.com/a/XQAVV (http://imgur.com/a/XQAVV)
When I plug it in I get square boxes on the first line like the tutorial suggests, but they never go away, I've tried adjusting the contrast on the back knob.
-
The 4.7k pullups need to go between the data lines and the 5v, not in series with the data lines.
So:
5v
|
4.7kohm
|
SDA-----------P0
and the same for SCK as well.
You'll also want to make sure you have the correct I2C address
-
I have a question about some code and weird anomalies.
Basic LCD functions:
- LCD outputs internal beer temp and ambient air temp. http://imgur.com/S0rYvaa (http://imgur.com/S0rYvaa)
- LCD clears
- LCD outputs target temp and heater(relay) status http://imgur.com/OtFXG1K (http://imgur.com/OtFXG1K)
float inside_temp;
float outside_temp;
float target = 74.00;
//inside_temp and outside_temp are values from 2 ds18b20's
inside_temp = 70.70;
outside_temp = 70.81;
LCD works when using this code with it commented out like this. Compiled size 5,928 bytes.
if(inside_temp < target){
//create a limit so heater isn't crazy hot as 5 gallons takes a while to change temp
// float limit = target + 1;
// if(outside_temp > limit){
// digitalWrite(RELAY_PIN, LOW);
// lcd.print("OFF");
// }
// else{
digitalWrite(RELAY_PIN, HIGH);
lcd.print("ON");
// }
}
else{
digitalWrite(RELAY_PIN, LOW);
lcd.print("OFF");
}
LCD also works with this code. Compiled size 5,590 bytes.
// if(inside_temp < target){
//create a limit so heater isn't crazy hot as 5 gallons takes a while to change temp
float limit = target + 1;
if(outside_temp > limit){
digitalWrite(RELAY_PIN, LOW);
lcd.print("OFF");
}
else{
digitalWrite(RELAY_PIN, HIGH);
lcd.print("ON");
}
// }
// else{
// digitalWrite(RELAY_PIN, LOW);
// lcd.print("OFF");
// }
LCD does NOT work when uncommented. Compiled size 5,992 bytes. All it does is sit there with the backlit on and no text. http://imgur.com/xPAzY0N,DdGdYoI (http://imgur.com/xPAzY0N,DdGdYoI)
if(inside_temp < target){
//create a limit so heater isn't crazy hot as 5 gallons takes a while to change temp
float limit = target + 1;
if(outside_temp > limit){
digitalWrite(RELAY_PIN, LOW);
lcd.print("OFF");
}
else{
digitalWrite(RELAY_PIN, HIGH);
lcd.print("ON");
}
}
else{
digitalWrite(RELAY_PIN, LOW);
lcd.print("OFF");
}
I don't understand why this happens. Can I not structure code like this?
-
I think the issue might be that the sketch is too big - which wouldn't make sense since 6010 bytes are available - but it might be worth a try to cut some bytes out of the sketch and see if it works.