Its C's arcane syntax for type-casting. For instance:
char x = (char) 0xFF ;
(Since char is signed, 0xFF is out of range, but the cast tells the compiler to not care).
int x = (int) 4.5 ;
Here the cast does more, it makes the compiler do a dataconversion by performing truncate() on the float value and taking the integer result. (I think).
In many situations the compiler automatically converts types, but when it doesn't a cast can force it to either convert or stop complaining. In particular casting pointer- and reference- typed expressions enables the data stored at that address to be treated as if of a different type.
I modified my code - I am just learning how to communicate with Betwino and this is a test program to figure that out. Here is the code
// Test reading a file using the Betwino RFLIN command //
char text;
char hold;
void setup() {
Serial.begin(9600);
}
void loop(){
Serial.println("#S|TEXTEST|[1]#"); //send Betwino command
text = Serial.readBytes((char*)hold, 7); //get TEXTEST characters
Serial.println(text); /*output the result - I know that Betwino will not
recognize it, I just want to see what it is */
}
The file TEXTEST calls up a text file containing the 7 letters ABCDEFG. Betwino receives the command OK and outputs the characters. However, the variable text does not have any of them - it comes up with some cryptic ASCII character - can't really make out which one it is but that does not matter.