Probleme avec LCD 1602 I2C

Bonjour a tous,
Nouveau sur le forum et novice avec arduino... Je galére un peu (nan beaucoup :grin:) avec mon écran LCD IIC I2C TWI 1602 que j'éssai de brancher sur ma carte arduino UNO R3.Malgre les recommandation du vendeur il doit y avoir quelque chose que je fait mal...
L'écran vient d'ebay le vendeur donne ce lien http://arduino-info.wikispaces.com/LCD-Blue-I2C#v1 j'ai branché comme indiqué, téléchargé la librairie, copie le sketch du lien ci dessus , mais il me donne un message d'erreur "HelloWorld:19: error: 'POSITIVE' was not declared in this scope"
J'ai tester durant plusieurs heure différente chose comme les exemples de croquis en modifiant certaine ligne mais au mieux j'ai réussit a faire clignoté le curseur ou éteindre l'écran...

/*-----( 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 )-----*/
/*-----( 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(0x27, 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 16 chars 2 lines, 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(0,0); //Start at character 4 on line 0
  lcd.print("Hello, world!");
  delay(1000);
  lcd.setCursor(0,1);
  lcd.print("HI!YourDuino.com");
  delay(8000);  

// Wait and then tell user they can start the Serial Monitor and type in characters to
// Display. (Set Serial Monitor option to "No Line Ending")
  lcd.clear();
  lcd.setCursor(0,0); //Start at character 0 on line 0
  lcd.print("Use Serial Mon");
  lcd.setCursor(0,1);
  lcd.print("Type to display");  


}/*--(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 ) */

Si quelqu'un a une solution je suis preneur !!!

Salut,

Ca sent le gros n'importe quoi ton lien, tout est mélangé : i2c, parallele 8 bits ...

Choppe la lib ici y'a plein d'exemple dedans :
https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads

Bonsoir,
+1
Montre nous le schéma que tu utilises
@+

Merci de vos rêponse, donc déjà voila le schéma (celui que j'ai suivi) :

Ensuite , téléchargé une lib de ton lien (en fait je les avais déja testé!) et j'ai ouvert un exemple voici le code

Pour le coup rien ne ce passe..

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>



#define BACKLIGHT_PIN     13

LiquidCrystal_I2C lcd(0x27);  // Set the LCD I2C address

//LiquidCrystal_I2C lcd(0x38, BACKLIGHT_PIN, POSITIVE);  // Set the LCD I2C address


// Creat a set of new characters
const uint8_t charBitmap[][8] = {
   { 0xc, 0x12, 0x12, 0xc, 0, 0, 0, 0 },
   { 0x6, 0x9, 0x9, 0x6, 0, 0, 0, 0 },
   { 0x0, 0x6, 0x9, 0x9, 0x6, 0, 0, 0x0 },
   { 0x0, 0xc, 0x12, 0x12, 0xc, 0, 0, 0x0 },
   { 0x0, 0x0, 0xc, 0x12, 0x12, 0xc, 0, 0x0 },
   { 0x0, 0x0, 0x6, 0x9, 0x9, 0x6, 0, 0x0 },
   { 0x0, 0x0, 0x0, 0x6, 0x9, 0x9, 0x6, 0x0 },
   { 0x0, 0x0, 0x0, 0xc, 0x12, 0x12, 0xc, 0x0 }
   
};

void setup()
{
   int charBitmapSize = (sizeof(charBitmap ) / sizeof (charBitmap[0]));

  // Switch on the backlight
  pinMode ( BACKLIGHT_PIN, OUTPUT );
  digitalWrite ( BACKLIGHT_PIN, HIGH );
  
  lcd.begin(16,2);               // initialize the lcd 

   for ( int i = 0; i < charBitmapSize; i++ )
   {
      lcd.createChar ( i, (uint8_t *)charBitmap[i] );
   }

  lcd.home ();                   // go home
  lcd.print("Hello, ARDUINO ");  
  lcd.setCursor ( 0, 1 );        // go to the next line
  lcd.print (" FORUM - fm   ");
  delay ( 1000 );
}

void loop()
{
   lcd.home ();
   // Do a little animation by writing to the same location
   for ( int i = 0; i < 2; i++ )
   {
      for ( int j = 0; j < 16; j++ )
      {
         lcd.print (char(random(7)));
      }
      lcd.setCursor ( 0, 1 );
   }
   delay (200);
}

Il y a vraiment un truc que je doit mal faire !!!!

750px-connect_dfr0154.gif

Bonjour,
Pour que le bus I2C fonctionne il faut des résistances de pullup sur les lignes SDA SCL.
Ton LCD possède-t-il ces résistances (voir dans le datasheet du LCD) ?
Si ce n'est pas le cas, il faut ajouter une résistance de 4,7k entre le +5V et la lignes SDA. Idem pour la ligne SCL.
@+

Merci de ta réponse, aucun idée pour les résistances !!! mis a part le lien de mon premier post j'ai que le texte de l'annonce, a savoir :

It is another great Yellow backlight LCD display. As the pin resources of Arduino controller is limited, your project may be not able to use normal LCD shield after connected with a certain quantity of sensors or SD card. However, with this I2C interface LCD module, you will be able to realize data display via only 2 wires. If you already has I2C devices in your project, this LCD module actually cost no more resources at all. It is fantastic for Arduino based project.

Specification

I2C Address: 0x27

Backlight (White character on Blue background)

Supply voltage: 5V

Size: 82x35x18 mm

Come with IIC interface, which can be connected by DuPont Line

Package Include

1 X IIC/I2C/TWI 1602 Serial LCD Module

Dans le doute j'ai monter des résistances de 4.7 comme ci dessous mais pas de changement !

donnez le lien de l'annonce

un lcd i2c est composé d'un module i2c et d'un lcd // standard, les modules i2c peuvent différer : adresse i2c certains permettent de choisir l'adresse si pastilles a0 a1 a2, je teste chaque module i2c avec i2c scanner avant toute utilisation

http://playground.arduino.cc/Main/I2cScanner

le module i2c est constitué d'un i/o expander : meme l'adresse de base (a0 a1 a2 à 0) est différente si le module est basé sur pcf8574 ou pcf8574A meme les librairies i2c ne sont pas toutes compatibles avec tous les modules i2c

Merci !! Le scan donne 0x27 donc les données du vendeur !!
L'annonce :

Je test avec ça, mais il me donne deux erreurs,

//DFRobot.com
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup()
{
  lcd.init();                      // initialize the lcd 
 
  // Print a message to the LCD.
  lcd.backlight();
  lcd.print("Hello, world!");
}

void loop()
{
}

HelloWorld:7: error: invalid conversion from 'int' to 't_backlighPol'
HelloWorld:7: error: initializing argument 3 of 'LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t, uint8_t, t_backlighPol)'
C:\Users\julien_2\Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal_I2C.h: In function 'void setup()':
C:\Users\julien_2\Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal_I2C.h:154: error: 'int LiquidCrystal_I2C::init()' is private
HelloWorld:11: error: within this context

XD

je compile ton exemple sans arduino connecté et je n'ai pas d'erreur

Merci de ta réponse, j'ai aussi compilé sans arduino et j'ai les mêmes erreur :~

ta biblio n'est pas dans le bon répetoire : tu melanges liquidCrystal et liquidcrystal_i2c.h

ton chemin : Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal_I2C.h:

tu devrais nettoyer tes répertoires arduino point de vue librairies

je conviens que d'une maniere générale, les librairies intégrées les librairies importés les croquis créés sont dans des répertoires différents : programmes(program files)/arduino/ .... et ensuite documents/arduino/.....

combien de librairies lcd y-a-t-il dans les 2 repertoires "arduino/librairies"

AHHHHHHHHH MERCI !!!!!!

Pffff donc finalement après un bon et gros nettoyage des répertoires ! Ça fonctionne ! j'ai cherché partout une erreur sauf la !

Merci encore !!!! Je vais pouvoir avancer sur mon projet maintenant XD

ce fut un plaisir

Bonjour,
J' viens de trouver la solution a votre problème car j'ai eu le mème depuis 3 jours.
vous aller sur le site www.sunfounder.com et vous faite un copier/coller du programme
donné pour I2C LCD 1602.
Je viens de le testé et ça marche très bien.
Bien cordialement
Gérard

/********************************

  • name:I2C LCD1602
  • function:You should now see your I2C LCD1602 display the flowing characters: "SunFounder" and "hello, world".
    ********************************/
    //Email:support@sunfounder.com
    //Website:www.sunfounder.com

//
// librairie de l'ecran LCD I2C 1602
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
//
char array1[]="ARDUINO ELECTRONIQUE "; // texte 1
char array2[]="bonjour "; // texte 2
char array3[]="Gerard "; // texte 3
int tim = 300; //the value of delay time
// initialize the library with the numbers of the interface pins
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
/
/
void setup()
{
lcd.init();
lcd.backlight();
}
/
/
void loop()
{
//
***********************************************
lcd.setCursor(15,0);
for (int positionCounter1 = 0; positionCounter1 < 26; positionCounter1++)
{
lcd.scrollDisplayLeft();
lcd.print(array1[positionCounter1]);
delay(tim);
}
//***********************************************************************
lcd.clear();
//***********************************************************************
lcd.setCursor(15,1); // set the cursor to column 15, line 1
for (int positionCounter = 0; positionCounter < 26; positionCounter++)
{
lcd.scrollDisplayLeft(); //Scrolls the contents of the display one space to the left.
lcd.print(array3[positionCounter]); // Print a message to the LCD.
delay(tim); //wait for 250 microseconds
}
//**********************************************************************
lcd.clear();
//**********************************************************************

lcd.setCursor(15,0); // set the cursor to column 15, line 0
for (int positionCounter1 = 0; positionCounter1 < 26; positionCounter1++)
{
lcd.scrollDisplayLeft(); //Scrolls the contents of the display one space to the left.
lcd.print(array2[positionCounter1]); // Print a message to the LCD.
delay(tim); //wait for 250 microseconds
}
//**********************************************************************
lcd.clear(); //Clears the LCD screen and positions the cursor in the upper-left corner.
}
/************************************************************/