TavIR I2C_LCD -hez Függvénykönyvtár.

Hogyha sikeresen O/PLED illetve hagyományos alfanumerikus - esetleg tán grafikus kijelzővel gyűlik meg a baja valakinek:)
gypali
Újonc
Újonc
Hozzászólások: 10
Csatlakozott: 2015. április 27. hétfő, 5:57

Re: TavIR I2C_LCD -hez Függvénykönyvtár.

Hozzászólás Szerző: gypali »

Ja és 1.0.5 -ös arduinio verzió.
gypali
Újonc
Újonc
Hozzászólások: 10
Csatlakozott: 2015. április 27. hétfő, 5:57

Re: TavIR I2C_LCD -hez Függvénykönyvtár.

Hozzászólás Szerző: gypali »

Scanning...
I2C device found at address 0x27 !
done
Avatar
Robert
Elektronbűvölő
Hozzászólások: 10191
Csatlakozott: 2005. december 9. péntek, 7:00

Re: TavIR I2C_LCD -hez Függvénykönyvtár.

Hozzászólás Szerző: Robert »

Mi a programkód amit használsz? melyik I2C lcd-megszólítást?
Van vmi szöveg az I2C illesztőn? Lábkosztás v egyéb? (3 féle létezik...)
gypali
Újonc
Újonc
Hozzászólások: 10
Csatlakozott: 2015. április 27. hétfő, 5:57

Re: TavIR I2C_LCD -hez Függvénykönyvtár.

Hozzászólás Szerző: gypali »

Kód: Egész kijelölése

/* TavIR I2C_LCD Example Software Sketch
 16 character 2 line I2C Display
 http://www.tavir.hu
 
 */

/*-----( 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
// 0x27 (4E) - PCF8574
// 0x3F (7E) - PCF8574A
// 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, 6, 5, 4, 3, 2, 1, 0, 7, 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 ) */

Ez a program...


az illesztő ic-n az áll, hogy pcf85741
gypali
Újonc
Újonc
Hozzászólások: 10
Csatlakozott: 2015. április 27. hétfő, 5:57

Re: TavIR I2C_LCD -hez Függvénykönyvtár.

Hozzászólás Szerző: gypali »

Az i2c scanninget ezzel csináltam...

Kód: Egész kijelölése

#include <Wire.h>
 
void setup()
 {
   Wire.begin();
 
  Serial.begin(115200);
   Serial.println("\nI2C Scanner");
 }
 
void loop()
 {
   byte error, address;
   int nDevices;
 
  Serial.println("Scanning...");
 
  nDevices = 0;
   for(address = 0; address <= 127; address++ )
  {
     // The i2c_scanner uses the return value of
     // the Write.endTransmisstion to see if
     // a device did acknowledge to the address.
     Wire.beginTransmission(address);
     error = Wire.endTransmission();
 
    if (error == 0)
     {
       Serial.print("I2C device found at address 0x");
       if (address<16)
        Serial.print("0");
       Serial.print(address,HEX);
       Serial.println(" !");
 
      nDevices++;
     }
     else if (error==4)
    {
       Serial.print("Unknow error at 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(8000);           // wait 8 seconds for next scan
 }
gypali
Újonc
Újonc
Hozzászólások: 10
Csatlakozott: 2015. április 27. hétfő, 5:57

Re: TavIR I2C_LCD -hez Függvénykönyvtár.

Hozzászólás Szerző: gypali »

Igy néz ki az illesztő
Nincs meg a kellő jogosultságod a hozzászóláshoz csatolt állományok megtekintéséhez.
gypali
Újonc
Újonc
Hozzászólások: 10
Csatlakozott: 2015. április 27. hétfő, 5:57

Re: TavIR I2C_LCD -hez Függvénykönyvtár.

Hozzászólás Szerző: gypali »

Köszönöm szépen a fejtörést,de kibogaráztam, hol a hiba.
Ez okozta a problémát!A tavir i2c-ben van, azzal nem működött.


De így már megy.
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
airween
Újonc
Újonc
Hozzászólások: 8
Csatlakozott: 2015. április 7. kedd, 22:10

Re: TavIR I2C_LCD -hez Függvénykönyvtár.

Hozzászólás Szerző: airween »

Sziasztok,

nemrég beszereztem a Tavir webshop-ból egy LCD-t, és egy I2C illesztőt:
http://shop.tavir.hu/product_info.php/l ... vito-p-157

Az I2C illesztőt beforrasztottam az LCD-be - nem tudom, ez így jó-e?

A gondom az, hogy semmilyen példa program nem fut rendesen. Az LCD háttér kapcsolható, az lcd.backlight() és lcd.noBacklight() működik, de semmilyen szöveg nem jelenik meg. A legutolsó feltöltött kód ez:

Kód: Egész kijelölése

   /* TavIR I2C_LCD Example Software Sketch
     16 character 2 line I2C Display
     http://www.tavir.hu
     
     */

    /*-----( 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
    // 0x27 (4E) - PCF8574
    // 0x3F (7E) - PCF8574A
    // 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 ) */
A scanner a 0x27-es porton találtam meg, ezt írtam be.

Köszi,

a.
airween
Újonc
Újonc
Hozzászólások: 8
Csatlakozott: 2015. április 7. kedd, 22:10

Re: TavIR I2C_LCD -hez Függvénykönyvtár.

Hozzászólás Szerző: airween »

airween írta: ...
A gondom az, hogy semmilyen példa program nem fut rendesen. Az LCD háttér kapcsolható, az lcd.backlight() és lcd.noBacklight() működik, de semmilyen szöveg nem jelenik meg.
...
Nos, miután félretettem a kódot, a kíváncsiságomtól vezérelve elkezdtem nézegetni az I2C illesztőt, és ott a progi - amivel a kontrasztot lehet állítani, ugye :). És elmozdítottam, mire megjelent a szöveg.

Bocs a lámaságért :)


a.
Avatar
Robert
Elektronbűvölő
Hozzászólások: 10191
Csatlakozott: 2005. december 9. péntek, 7:00

Re: TavIR I2C_LCD -hez Függvénykönyvtár.

Hozzászólás Szerző: Robert »

A kontrasztot nem programból állítod, hanem a kontrasztpotméterrel:)
airween
Újonc
Újonc
Hozzászólások: 8
Csatlakozott: 2015. április 7. kedd, 22:10

Re: TavIR I2C_LCD -hez Függvénykönyvtár.

Hozzászólás Szerző: airween »

Kedves Róbert,
Robert írta:A kontrasztot nem programból állítod, hanem a kontrasztpotméterrel:)
igen, tudom, erre írtam hogy "miután félretettem a kódot, a kíváncsiságomtól vezérelve elkezdtem nézegetni az I2C illesztőt".

Viszont most látom, hogy elírtam: nem progi, hanem poti :D, így szerintem már érthető lesz a mondandóm.

Köszi,

a.
usdzgfa
Újonc
Újonc
Hozzászólások: 1
Csatlakozott: 2015. november 1. vasárnap, 15:01

Re: TavIR I2C_LCD -hez Függvénykönyvtár.

Hozzászólás Szerző: usdzgfa »

gypali írta:Köszönöm szépen a fejtörést,de kibogaráztam, hol a hiba.
Ez okozta a problémát!A tavir i2c-ben van, azzal nem működött.


De így már megy.
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
Szia,
Én is eltöltöttem másfél napot a kérdéskörrel, pedig csak ezt a hozzászólást kellett volna elolvasni hamarabb.

gypali! Köszönöm.
Avatar
Robert
Elektronbűvölő
Hozzászólások: 10191
Csatlakozott: 2005. december 9. péntek, 7:00

Re: TavIR I2C_LCD -hez Függvénykönyvtár.

Hozzászólás Szerző: Robert »

A WebShopban is ott a mintaprogi gyűjtemény, azzal is ki kll próbálni :)
Mouset
DrótVégénSzéndarab
Hozzászólások: 35
Csatlakozott: 2016. szeptember 10. szombat, 7:13

Re: TavIR I2C_LCD -hez Függvénykönyvtár.

Hozzászólás Szerző: Mouset »

Sziasztok,

Kezdőként küzdök az I2C LCD illesztővel.
A kezdőcsomagos LCD kijelzővel (2x16 zöld háttér, fekete betűk) próbálom de a kód ellenőrzésénél ezt a hibaüzenetet kapom:

"error: 'POSITIVE' was not declared in this scope"

Egyszerűen nem jövök rá hogy mi a baj, tegnap este 3 órán keresztül, olvasgattam, kerestem, próbálkoztam de semmi.

Mi lehet a gond?
Előre is köszönöm a segítséget.
Krisztián
Avatar
Robert
Elektronbűvölő
Hozzászólások: 10191
Csatlakozott: 2005. december 9. péntek, 7:00

Re: TavIR I2C_LCD -hez Függvénykönyvtár.

Hozzászólás Szerző: Robert »

NewLiauidCrystal telepÍt.
https://bitbucket.org/fmalpartida/new-l ... /downloads

Mintakód:

Kód: Egész kijelölése

/* TavIR I2C_LCD Example Software Sketch
 16 character 2 line I2C Display
 www.tavir.hu
 
 */

/*-----( 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
// 0x27 (4E) - PCF8574
// 0x3F (7E) - PCF8574A
// 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, 4, 5, 6, 0, 1, 2, 3, 7, NEGATIVE);  // GY-IICLCD (kek)
//LiquidCrystal_I2C lcd(0x27, 6, 5, 4, 3, 2, 1, 0, 7, POSITIVE);  // Set the LCD I2C address (green pcb)
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address (black pcb)
//LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address (black pcb)

/*-----( 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! www.tavir.hu");
  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 ) */


De minden fenn van a WebShopban a cikk alatt a dokumentációk közt is...
Vagy ennek a fórumnak a közepén - függően melyik arduinot hazsnálod.
http://www.tavir.hu - a gazda :)
Válasz küldése