Pages: [1]   Go Down
Author Topic: call of overloaded 'write (int)' is ambigiuos  (Read 307 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 1
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

When I try to compile I get this error
"call of overloaded 'write (int)' is ambigiuos"
Here is the parts of my code I think the error is in:
Code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);


byte paddleup[8] = {
  0b10000,
  0b10000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000
};

byte paddletwo[8] = {
  0b00000,
  0b00000,
  0b10000,
  0b10000,
  0b00000,
  0b00000,
  0b00000,
  0b00000
};

byte paddleone[8] = {
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b10000,
  0b10000,
  0b00000,
  0b00000
};

byte paddledown[8] = {
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b10000,
  0b10000
 
};
byte ballone[8] = {
  0b00000,
  0b00100,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000
};

byte balltwo[8] = {
  0b00000,
  0b00000,
  0b00000,
  0b00100,
  0b00000,
  0b00000,
  0b00000,
  0b00000
};

byte ballthree[8] = {
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00100,
  0b00000,
  0b00000
};
byte ballfour[8] = {
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00100
};






void setup() {
  // set up the LCD's number of columns and rows:
  lcd.createChar(0, ballone);
  // create a new character
  lcd.createChar(1, balltwo);
  // create a new character
  lcd.createChar(2, ballthree);
  // create a new character
  lcd.createChar(3, ballfour); 
  // create a new character
  lcd.createChar(4, paddleup);
  // create a new character
  lcd.createChar(5, paddletwo);
  // create a new character
  lcd.createChar(6, paddleone);
  // create a new character
  lcd.createChar(7, paddledown); 
 
And the other part:
Code:
lcd.setCursor(6, 1);
lcd.write(0);
delay(100);
if (pushButton == HIGH); {
  x = x+1;
  }
Logged

North Queensland, Australia
Offline Offline
Edison Member
*
Karma: 66
Posts: 2116
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It is saying it needs more information.

Code:
lcd.write(0);

This can match a couple of write methods, provide more context by casting it to what you desire ( have a look at the lcd library and what overloads it provides ).

Code:
lcd.write( ( byte ) 0 );
lcd.write( int(0) );
lcd.write( 0.0f );

Logged


Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 203
Posts: 8720
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think the problem is that 0 can be interpreted as either a byte:
Code:
virtual size_t LCD::write(uint8_t)

or a null character pointer:
Code:
size_t Print::write(const char*)

Instead, use '\0' which is a character constant or cast it: (uint8_t)0
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Jr. Member
**
Karma: 1
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

so I can use '/0'?
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks it worked!!!
Logged

North Queensland, Australia
Offline Offline
Edison Member
*
Karma: 66
Posts: 2116
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

yes, '\0' is a null character, there is a number of escape characters:

Quote
\' \" \? \\
\a \b \f \n \r \t \v

search google for a full explanation.
Logged


Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 291
Posts: 25884
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
so I can use '/0'?
No, you cannot - it is a multicharacter literal consisting of the characters '/' and '0'.
You can use '\0'.

OP - stop locking or deleting your threads.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Pages: [1]   Go Up
Jump to: