Problema con I2c LCM1602 IIC Funduino lcd 2*16


salve tutti ragazzi, sono un novello in questo campo quindi mi scuso in anticipo se non sarò molto tecnico.
ho comprato uno strater kit arduino in cui ho trovato un lcd  16*2 con già impiantato un  funduino i2c.
in questi giorni volevo realizzare qualcosa con lo schermo lcd ma non riesco visualizzare nulla. vorrei almeno riuscire visualizzare "hello" non chiedo altro :p.
ora vi spiego passo passo cosa ho fatto:
1) questo è layout

2) ho scaricato la nuova libreria da questo linkhttps://bitbucket.org/fmalpartida/new-liquidcrystal/downloads e l'ho sostituita quella  di default dell'arduido eliminando la cartella direttamente dalla directory di installazione
3) ho trovato l'indirizzo dell'i2c con il seguente codice:
code: [select]

#include <wire.h>
void setup()
{
  wire.begin();

  serial.begin(9600);
  serial.println("\ni2c scanner");
}


void loop()
{
  byte error, address;
  int ndevices;

  serial.println("scanning...");

  ndevices = 0;
  for(address = 1; address < 127; address++ )
  {
    // i2c_scanner uses return value of
    // write.endtransmisstion see if
    // device did acknowledge address.
    wire.begintransmission(address);
    error = wire.endtransmission();

    if (error == 0)
    {
      serial.print("i2c device found @ address 0x");
      if (address<16)
        serial.print("0");
      serial.print(address,hex);
      serial.println("  !");

      ndevices++;
    }
    else if (error==4)
    {
      serial.print("unknow error @ address 0x");
      if (address<16)
        serial.print("0");
      serial.println(address,hex);
    }   
  }
  if (ndevices == 0)
    serial.println("no i2c devices found\n");
  else
    serial.println("done\n");

  delay(5000);           // wait 5 seconds next scan
}

e tramite il monitor seriale mi è stato segnalato l'indirizzo cercato 0x27
4)poi ho utilizzato uno dei semplici esempi per visualizzare hello
code: [select]
#include <wire.h>
#include <liquidcrystal_i2c.h>



#define backlight_pin     13

liquidcrystal_i2c lcd(0x27);  // set lcd i2c address

//liquidcrystal_i2c lcd(0x27, backlight_pin, positive);  // set lcd i2c address


// creat 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 backlight
  pinmode ( backlight_pin, output );
  digitalwrite ( backlight_pin, high );
 
  lcd.begin(16,2);               // initialize lcd

   for ( int = 0; < charbitmapsize; i++ )
   {
      lcd.createchar ( i, (uint8_t *)charbitmap[i] );
   }

  lcd.home ();                   // go home
  lcd.print("hello, arduino "); 
  lcd.setcursor ( 0, 1 );        // go next line
  lcd.print (" forum - fm   ");
  delay ( 1000 );
}

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

ma non ho ottenuto  nessun risultato. lcd risulta cmq illuminato

benvenuto.  :)
ti invitiamo presentarti qui: http://forum.arduino.cc/index.php?topic=113640.0
e leggere il regolamento: http://forum.arduino.cc/index.php?topic=149082.0
- qui una serie di schede xxxpighi per collegamenti elettronici vari: http://forum.arduino.cc/index.php?topic=146152.0
- qui le pinout delle varie schede xxxpighi: http://forum.arduino.cc/index.php?topic=151646.0
- qui una serie di link generici utili: http://forum.arduino.cc/index.php?topic=126861.0


Arduino Forum > International > Italiano > Software (Moderator: leo72) > Problema con I2c LCM1602 IIC Funduino lcd 2*16


arduino

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support