BOA TARDE AMIGOS .. NÃO ESTOU CONSEGUINDO CARREGAR A BIBLIOTECA DISPLAY NO ARDUINO DUE ..ALGUMA AJUDA

HelloWorld_i2c.ino

Exibições: 1292

Responder esta

Respostas a este tópico

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

#define I2C_ADDR 0x3F
#define BACKLIGHT_PIN 3
#define En 2
#define Rw 1
#define Rs 0
#define D4 4
#define D5 5
#define D6 6
#define D7 7

LiquidCrystal_I2C lcd ( I2C_ADDR,En,Rw,Rs,D4,D5,D6,D7);

void setup()
{
lcd.begin(16,2);
// Switch on the backlight
lcd.setBacklightPin( BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH)
lcd.setCursor(4,0);
lcd.print("LUIZ");
lcd.setCursor(4,1):
cd.print("LUIZ"):
}

void loop()
{


}

C:\Users\soste\OneDrive\Documentos\Arduino\sketch_mar14a\sketch_mar14a.ino: In function 'void setup()':

sketch_mar14a:23: error: expected ';' before 'lcd'

lcd.setCursor(4,0);

^

sketch_mar14a:25: error: expected ';' before ':' token

lcd.setCursor(4,1):

^

exit status 1
expected ';' before 'lcd'

C:\Users\soste\OneDrive\Documentos\Arduino\sketch_mar14a\sketch_mar14a.ino: In function 'void setup()':

sketch_mar14a:23: error: expected ';' before 'lcd'

lcd.setCursor(4,0);

^

sketch_mar14a:25: error: expected ';' before ':' token

lcd.setCursor(4,1):

^

exit status 1
expected ';' before 'lcd'

Arduino DUE usa sinais digitais com nivel 3,3V.

Qual Display esta usando ? (normalmente o display usa sinais digitais de 5V).

Especificações:
- Display LCD 16x2
- Backlight: verde
- Cor dos caracteres: preto
- Controlador: HD44780
- Adaptador display I2C integrado
- Potenciômetro para ajuste do contraste
- Tensão de operação: 5V
- Linhas: 2
- Colunas: 16
- Interface: I2C
- Dimensões: 80 x 36 x 12mm
- Área visível: 64,5 x 16mm

Boa noite! na foto de coneccao dos pinos , no Arduino Due os pinos do I2C nao sao os A4 e A5 , sao  D20 e D21,

foto das pinagem do Arduino Due em anexo.

Anexos

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

#define BACKLIGHT_PIN 13

LiquidCrystal_I2C lcd(0x3F); // 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);
}

E ESSO FO O CODIGO DE ERRO:


Opções de compilação alteradas, recompilando tudo
In file included from C:\Users\soste\OneDrive\Documentos\Arduino\libraries\NewliquidCrystal\LiquidCrystal_SR1W.cpp:35:0:

C:\Users\soste\OneDrive\Documentos\Arduino\libraries\NewliquidCrystal\LiquidCrystal_SR1W.cpp: In member function 'uint8_t LiquidCrystal_SR1W::clearSR()':

C:\Users\soste\OneDrive\Documentos\Arduino\libraries\NewliquidCrystal\LiquidCrystal_SR1W.cpp:77:24: error: invalid type argument of unary '*' (have 'fio_register {aka unsigned char}')

SR1W_ATOMIC_WRITE_LOW(srRegister, srMask);

^

C:\Users\soste\OneDrive\Documentos\Arduino\libraries\NewliquidCrystal\LiquidCrystal_SR1W.h:293:79: note: in definition of macro 'SR1W_ATOMIC_WRITE_LOW'

#define SR1W_ATOMIC_WRITE_LOW(reg, mask) ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { *reg &= ~mask; }

^

C:\Users\soste\OneDrive\Documentos\Arduino\libraries\NewliquidCrystal\LiquidCrystal_SR1W.cpp:86:22: error: invalid type argument of unary '*' (have 'fio_register {aka unsigned char}')

fio_bit reg_val = *srRegister;

^

C:\Users\soste\OneDrive\Documentos\Arduino\libraries\NewliquidCrystal\LiquidCrystal_SR1W.cpp:95:5: error: invalid type argument of unary '*' (have 'fio_register {aka unsigned char}')

*srRegister = bit_high;

^

C:\Users\soste\OneDrive\Documentos\Arduino\libraries\NewliquidCrystal\LiquidCrystal_SR1W.cpp:96:5: error: invalid type argument of unary '*' (have 'fio_register {aka unsigned char}')

*srRegister = bit_low;

^

C:\Users\soste\OneDrive\Documentos\Arduino\libraries\NewliquidCrystal\LiquidCrystal_SR1W.cpp:101:4: error: invalid type argument of unary '*' (have 'fio_register {aka unsigned char}')

*srRegister = bit_high;

^

C:\Users\soste\OneDrive\Documentos\Arduino\libraries\NewliquidCrystal\LiquidCrystal_SR1W.cpp: In member function 'uint8_t LiquidCrystal_SR1W::loadSR(uint8_t)':

C:\Users\soste\OneDrive\Documentos\Arduino\libraries\NewliquidCrystal\LiquidCrystal_SR1W.cpp:139:24: error: invalid type argument of unary '*' (have 'fio_register {aka unsigned char}')

fio_bit reg_val = *srRegister;

^

C:\Users\soste\OneDrive\Documentos\Arduino\libraries\NewliquidCrystal\LiquidCrystal_SR1W.cpp:144:6: error: invalid type argument of unary '*' (have 'fio_register {aka unsigned char}')

*srRegister = bit_low;

^

C:\Users\soste\OneDrive\Documentos\Arduino\libraries\NewliquidCrystal\LiquidCrystal_SR1W.cpp:145:6: error: invalid type argument of unary '*' (have 'fio_register {aka unsigned char}')

*srRegister = bit_high;

^

In file included from C:\Users\soste\OneDrive\Documentos\Arduino\libraries\NewliquidCrystal\LiquidCrystal_SR1W.cpp:35:0:

C:\Users\soste\OneDrive\Documentos\Arduino\libraries\NewliquidCrystal\LiquidCrystal_SR1W.cpp:151:26: error: invalid type argument of unary '*' (have 'fio_register {aka unsigned char}')

SR1W_ATOMIC_WRITE_LOW(srRegister, srMask);

^

C:\Users\soste\OneDrive\Documentos\Arduino\libraries\NewliquidCrystal\LiquidCrystal_SR1W.h:293:79: note: in definition of macro 'SR1W_ATOMIC_WRITE_LOW'

#define SR1W_ATOMIC_WRITE_LOW(reg, mask) ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { *reg &= ~mask; }

^

C:\Users\soste\OneDrive\Documentos\Arduino\libraries\NewliquidCrystal\LiquidCrystal_SR1W.cpp:158:27: error: invalid type argument of unary '*' (have 'fio_register {aka unsigned char}')

SR1W_ATOMIC_WRITE_HIGH(srRegister, srMask);

^

C:\Users\soste\OneDrive\Documentos\Arduino\libraries\NewliquidCrystal\LiquidCrystal_SR1W.h:294:80: note: in definition of macro 'SR1W_ATOMIC_WRITE_HIGH'

#define SR1W_ATOMIC_WRITE_HIGH(reg, mask) ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { *reg |= mask; }

^

exit status 1
Erro compilando para a placa Arduino Due (Programming Port)

Ligacao display Arduino Due

Anexos

Bom dia Luiz,esperimenta esse sketch, compila e se der certo, carrega ele , e ve se da certo,

Anexos

desculpa ontem , e que fiquei sem rede , caiu a internet, aqui e via radio,

Bom dia ! conseguiu fazer funcionar ?

ENTÃO EU A CREDITO QUE ESTRAGUEI O MODULO I2C, OU QUE NÃO ESTOU OFERECENDO CARGA NECESSÁRIA, NOS PINOS 20, 21, SDA ,SCL, VISTO QUE O DUE TRABALHA EM 3,3V, PRECISO UTILIZAR UM ONVERSOR LÓGICO PRA TAL
.

RSS

© 2024   Criado por Marcelo Rodrigues.   Ativado por

Badges  |  Relatar um incidente  |  Termos de serviço