chipKIT® Development Platform

Inspired by Arduino™

Ambiguous reference

Created Sun, 18 Dec 2011 05:51:02 +0000 by pdimond


pdimond

Sun, 18 Dec 2011 05:51:02 +0000

OK, I should be able to fix this myself, but...

Serial2.write(0);

throws:

 CameraInterface.cpp: In function 'void setup()':
 CameraInterface.cpp:32:28: error: call of overloaded 'write(int)' is ambiguous
 C:\mpide-0022\hardware\pic32\cores\pic32/HardwareSerial.h:169:16: note:   candidates are: virtual void HardwareSerial::write(__uint8_t)
 C:\mpide-0022\hardware\pic32\cores\pic32/Print.h:51:15: note:                 virtual void Print::write(const char*)

I have to write it as:

int val = 0; Serial2.write(val);

This is only when the value is zero.

Phil


avenue33

Sun, 18 Dec 2011 12:16:18 +0000

Try

Serial2.write((int8_t)0);

or

Serial2.print(0);

About int types, please read :arrow: here about the differences between Arduino and chipKIT platforms.

To add confusion, Arduino 1.0 introduces major changes compared to Arduino 0022 regarding serial, print and stream :( . MPIDE is currently based on Arduino 0022, so you may face unexpected error messages if you use an Arduino 1.0 sketch.


pdimond

Sun, 18 Dec 2011 22:29:25 +0000

Thanks. I realised a cast could do it, too .. I just thought I'd mention it in case it hadn't been noticed.

Cheers!


avenue33

Sun, 18 Dec 2011 22:36:57 +0000

You're welcome :!:

That's the kind of bugs you could spend a whole day on until someone gives you a hint ;)