Ciao a tutti, innanzitutto mi presento, sono nuovo di questo appassionante mondo di Arduino. il mio nome è Gabriele —> CASPA per i forum
Ho iniziato da un paio di settimane totalmente ignorante di elettronica e Arduino e programmazione in C… e in poco tempo mi sono realizzato un semplice controller per gestire acquario, temperatura con 2 sonde che gestiscono relè per riscaldatore, selezione temperatura tramite potenziometro, 2 sonde di livello con relativo relè per reintegro acqua, vari allarmi di funzionamento. insomma mi sto divertendo alla grande.
Ora arrivo al problema, volevo aggiungere display LCD per vedere alcuni dati impostati ma non volendo utilizzare 7 pin di ARDUINO UNO rev3 ho preso questo su arduiner (si può dire? in caso censuratelo…)
The Arduino IIC/I2C 1602 LCD Module
ma non cè modi di farlo andare… e non capisco come mai…
ho scaricato librerie dal sito indicato dal sito di vendita qui …http://arduino-info.wikispaces.com/LCD-Blue-I2C
ho determinato che è una versione
LCD Version 3 - Marked "LCM1602 IIC A0 A1 A2”
ho collegato :
MODULO ARDUINO
GND ———————> GND
VCC ———————> 5V
SDA ———————> PIN A5
SCL ———————> PIN A4
ho usato questo script: (corretto per display 16 caratteri 2 righe)
——————————————————————————————
/* YourDuino.com Example Software Sketch
20 character 4 line I2C Display
Backpack Interface labelled "LCM1602 IIC A0 A1 A2"
terry@yourduino.com */
/*-----( Import needed libraries )-----*/
#include <Wire.h> // Comes with Arduino IDE
// Get the LCD I2C Library here:
// https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads
// Move any other LCD libraries to another folder or delete them
// See Library "Docs" folder for possible commands etc.
#include <LiquidCrystal_I2C.h>
/*-----( Declare Constants )-----*/
//none
/*-----( 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_I2C lcd(0x20, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
/*-----( Declare Variables )-----*/
//none
void setup() /*----( SETUP: RUNS ONCE )----*/
{
Serial.begin(9600); // Used to type in characters
lcd.begin(16,2); // initialize the lcd for 20 chars 4 lines and turn on backlight
// ------- Quick 3 blinks of backlight -------------
for(int i = 0; i< 3; i++)
{
lcd.backlight();
delay(250);
lcd.noBacklight();
delay(250);
}
lcd.backlight(); // finish with backlight on
//-------- Write characters on the display ----------------
// NOTE: Cursor Position: CHAR, LINE) start at 0
lcd.setCursor(3,0); //Start at character 4 on line 0
lcd.print("Hello, world!");
delay(1000);
lcd.setCursor(0,1);
lcd.print("From YourDuino");
}/*--(end setup )---*/
void loop() /*----( LOOP: RUNS CONSTANTLY )----*/
{
{
// when characters arrive over the serial port...
if (Serial.available()) {
// wait a bit for the entire message to arrive
delay(100);
// clear the screen
lcd.clear();
// read all the available characters
while (Serial.available() > 0) {
// display each character to the LCD
lcd.write(Serial.read());
}
}
}
}/* --(end main loop )-- */
/* ( THE END ) */
ma quando compilo mi da il seguente errore:
sketch_dec04a:19: error: ‘POSITIVE’ was not declared in this scope
sketch_dec04a.ino: In function 'void setup()’:
sketch_dec04a:33: error: ‘class LiquidCrystal_I2C’ has no member named ‘backlight’
sketch_dec04a:35: error: ‘class LiquidCrystal_I2C’ has no member named ‘noBacklight’
sketch_dec04a:38: error: ‘class LiquidCrystal_I2C’ has no member named ‘backlight’
e qui confermo la mia ignoranza e non so cosa fare…
potete aiutarmi?
aggiunto dopo —> ho provato vari indirizzi 0x20 , 0x27, 0x30, 0x38… niente… ho notato che sul PIC dell’adattatore è segnato PCF8574T