Go Down

Topic: 3.2 ITDB02 UTFT Shield: Rrror: conversion from 'int' to 'String' is ambiguous (Read 71 times) previous topic - next topic

kpstiehl

Hello,
The code below works proberly with print out "Peter" but neither with Val nor A as variable.
The serial print works instead..
Thanks for any help!
Peter

Hardware: Arduino 2560 with 3.2 ITDB02 UTFT Shield

/*Example: √úbernahme Analogwert
 */

#include <UTFT.h>
UTFT    myGLCD(ITDB32S,38,39,40,41);
extern uint8_t BigFont[];


int Sensor=A0;
int Led=13;
int Val;
int A;

void setup()
{
  pinMode(Led, OUTPUT);
  Serial.begin(9600);

  myGLCD.InitLCD();
  myGLCD.clrScr();
}
void loop()
{
  Val=analogRead(0);
  Serial.print("Val= ");
  Serial.print(Val);
  Serial.print("   Val+10= ");
  A=(Val+10);
  Serial.println(A);
  myGLCD.setColor(0, 255, 0);
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.setFont(BigFont);
  //myGLCD.print("Test", CENTER, 100);
  myGLCD.print(Val, CENTER, 100);
  //myGLCD.print(A, CENTER, 100);
  digitalWrite(Led, HIGH);
  delay (Val);
  digitalWrite(Led, LOW);
  delay (Val);
}

Error report:
  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: "Arduino Mega 2560 or Mega ADK"
Test.ino: In function 'void loop()':
Test:34: error: conversion from 'int' to 'String' is ambiguous
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/WString.h:61: note: candidates are: String::String(const __FlashStringHelper*) <near match>
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/WString.h:59: note:                 String::String(const char*) <near match>

ghlawrence2000

Might I refer you to the instructions? UTFT print options include
  • myGLCD.print(st,x,y);
  • myGLCD.printNumI(num,x,y);
  • myGLCD.printNumF(num,dec,x,y);


Regards,

Graham


Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy