I have pickup arduino in minimal configuration. Just Atmega168-20pu oscillator, two condensers and a lot of wires.
Upload a sketch with LCD & Dallas DS18b20.
It starts but in a few minuties appear garbage on the screen.
Do you have any ideas what can it be?
#include <Wire.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>
// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 10
/*-----( Declare Constants )-----*/
/*-----( Declare objects )-----*/
// set the LCD address to 0x27 for a 20 chars 4 line display
// Set the pins on the I2C chip used for LCD connections:
// addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // Set the LCD address
// Pass our oneWire reference to Dallas Temperature.
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
float Temp;
// degree c sybmol
byte degc[8] =
{
B01000,
B10100,
B01000,
B00011,
B00100,
B00100,
B00011,
B00000,
};
/*-----( Declare Variables )-----*/
//NONE
void setup() /*----( SETUP: RUNS ONCE )----*/
{
lcd.begin(16,2); // initialize the lcd for 16 chars 2 lines, turn on backlight
//-------- Write characters on the display ------------------
// NOTE: Cursor Position: (CHAR, LINE) start at 0
lcd.setCursor(0,0); //Start at character 4 on line 0
lcd.print("MyMachine");
delay(1000);
lcd.setCursor(0,1);
lcd.print("Temp IC Control");
delay(4000);
// Start up the library
sensors.begin();
// IC Default 9 bit. If you have troubles consider upping it 12.
// Ups the delay giving the IC more time to process the temperature measurement
lcd.createChar(0,degc);
}/*--(end setup )---*/
void loop() /*----( LOOP: RUNS CONSTANTLY )----*/
{
sensors.requestTemperatures(); // Send the command to get temperatures
delay(200);
lcd.clear();
lcd.setCursor(0,0); //Start at character 4 on line 0
lcd.print("Temp for Dev1:");
lcd.setCursor(2,1);
Temp = sensors.getTempCByIndex(0);
lcd.print(Temp);
lcd.setCursor(8,1);
lcd.write((uint8_t)0);
lcd.write(" ");
}/* --(end main loop )-- */
/* ( THE END ) */