noob has never worked with C /C++

hello everyone

i have just started to work with an arduino board, and now i am experiencing some difficulties concerning the programming of the board.

first question: what exactly does Serial.read() do? does it only read the next incoming byte? or does it also clear that byte so in order to work with it i will have to save it somewhere?

second question: my main objective is to get the board to process some signals coming from a digital audio mixer. these commands come in via a RS232 port. as i take it the arduino language interprets all numbers as decimal numbers, which will leave the incoming commands next to useless. how can i get the program to work with them as hex numbers?

greetings

max

p.s. please excuse the sucky english

what exactly does Serial.read() do? does it only read the next incoming byte? or does it also clear that byte so in order to work with it i will have to save it somewhere?

"read" takes one character from an internal buffer (if there is at least one in the buffer) and returns it to the caller. If no character is available, it returns -1. The character cannot be re-read from the buffer because the read method performs an automatic buffer pointer increment.

You must than store the character in a temporary location if you need to examine it more than once.

int tempChar;

if (Serial.available () > 0) {
  tempChar = Serial.read ();
}

as i take it the arduino language interprets all numbers as decimal numbers,

No, it interprets them as binary. To convert ASCII representations of hex numbers, you must perform the conversion yourself. Decimal digits 0-9 are represented by the values 0x30 - 0x39, and the hex digits A-F by the values 0x41-0x46, or a-f by the values 0x61-0x66