syntax problem: should I use Char, String or what?
hello everybody,
i'm trying make simple compass tells bearing in both words , degree (ex: 359 nord)
i got variable called "bearing" tell me exately degree (0-360)
and can word (north, south, west, east)
int x = bearing;
if (x < 44 || x > 315)
{
serial.println("nord");
}
else if (x > 45 && x < 134)
{
serial.println("est");
}
else if (x > 135 && x < 224)
{
serial.println("ovest");
}
else if (x > 225 && x < 314)
{
serial.println("sud");
}
this work fine!
what cannot working merge 2 variables
i tried
serial.println("sud"+bearing); // return blank line
serial.println("sud".bearing); // return error, cannot compile
i tried use
#include <string.h>
char msg(bearing);
serial.println("sud"+bearing); // return again blank line
how should do?
thank you
i'm trying make simple compass tells bearing in both words , degree (ex: 359 nord)
i got variable called "bearing" tell me exately degree (0-360)
and can word (north, south, west, east)
int x = bearing;
if (x < 44 || x > 315)
{
serial.println("nord");
}
else if (x > 45 && x < 134)
{
serial.println("est");
}
else if (x > 135 && x < 224)
{
serial.println("ovest");
}
else if (x > 225 && x < 314)
{
serial.println("sud");
}
this work fine!
what cannot working merge 2 variables
i tried
serial.println("sud"+bearing); // return blank line
serial.println("sud".bearing); // return error, cannot compile
i tried use
#include <string.h>
char msg(bearing);
serial.println("sud"+bearing); // return again blank line
how should do?
thank you
you can't add int , string, use 2 'print's
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > syntax problem: should I use Char, String or what?
arduino
Comments
Post a Comment