I new to Arduino and I'm attempting to writte a simple string compare code like this:
void loop()
{
distance(cm);
delay(200);
}
void distance(char[3] unit)
{
if (unit[] == "cm")
Serial.println("cm");
}
Could somebody please advise me how to writte it correctly? Thanks in advance!
char unit[3]
, or, betterchar * unit
. And you call likedistance("cm")
, with the quotes.== 0
to do a comparison.