Working with byte datatypes in version 1.0 of the IDE

I'm confused, with version 1.0 of the IDE, print(byte) now prints the integer value of the byte as ASCII characters.

Before

Serial.print(0x00, BYTE)

Now

Serial.write(0x00)

It doesn't work, I get this error: "error: call of overloaded 'write(int)' is ambiguous." What am I missing?

a second parameter is most probably required now to disambiguate.

is there a flag 'INT'

or have a look what the first parameters data type is and cast 0x00 to it

these are the sofware serial public member functions I found

    SoftwareSerial(uint8_t, uint8_t);
    void begin(long);
    int read();
    void print(char);
    void print(const char[]);
    void print(uint8_t);
    void print(int);
    void print(unsigned int);
    void print(long);
    void print(unsigned long);
    void print(long, int);
    void println(void);
    void println(char);
    void println(const char[]);
    void println(uint8_t);
    void println(int);
    void println(long);
    void println(unsigned long);
    void println(long, int);

try

Serial.print( (long) 0x00 )

oops, got list from 0023, 1.0 has probably changed.. Will download now.

It only seems to occur when the value is 0. Which makes me wonder if the overload is whether it is an integer or a null character?

Serial.write(0,1);

(val, len) seems to work

oh, and if the compiler error gives you a list of possible matches, modify your code to suit one of them.

a literal 0 can be accepted as almost anything, depending on the usage. E.g. char, bool, int, pointer...

The compiler tries to match the most specific.

I’m even more confused then I was before. I am rewriting my LCD custom character code and since there are a number of ways to do it, I’ve been playing around with the code a bit.

this works…

unsigned short custom_0[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x1f};

for (int x = 0; x < 8; x++){
Serial.write(custom_0[x]);
}

these will match.

void print(unsigned int);
void print(uint8_t);

try specifying it unsigned, this removes a bunch of possibilities

Serial.print( ( unsigned ) 0x00 );

Serial.print( ( unsigned ) 0x00 );

You really need to read the changes in 1.0. Serial.print() prints the ASCII value. The original poster is trying to write the value 0. That is now done with Serial.write().

http://arduino.cc/en/Serial/Print http://arduino.cc/en/Serial/Write

Serial.print(0); works fine.

Anyway, casting like this works for Serial.write(): Serial.write((uint8_t)0);

I think I understand now, thanks James.