There's no mention of a
square function in the Arduino reference at
http://arduino.cc/en/Reference/HomePage, but it's easy enough to define a C macro to do it.
An
itoa function is available if you #include the file
itoa.h.
The sketch below uses
itoa and
square and works as expected with a Due and Arduino 1.5.1r2.
HTH
Jim
#include "itoa.h"
#include "Print.h"
template<class T> inline Print &operator <<(Print &obj, T arg) { obj.print(arg); return obj; }
#define square(x) pow(x, 2)
int count = 1;
int ledPin = 13; // LED connected to digital pin 13
// Run once, when the sketch starts.
void setup()
{
Serial.begin(115200);
Serial.println("Blink");
count = 0;
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
}
void loop()
{
String s;
char temp[20];
Serial << "Blink: Loop " << count << ", " << itoa(count, temp, 10) << ", " << square(count) << (char)10;
digitalWrite(ledPin, HIGH);
delay(100);
digitalWrite(ledPin, LOW);
delay(900);
count++;
}