expected ')' before numeric constant

Hello, I'm new to the forum.

I'm using UART communication to communicate to a sensor. Commands to the sensor are in hex. I am getting error " expected ')' before numeric constant ", but I'm not sure why. Here my code:

//configuration of pins
int rxPin1 = 0;

int txPin1 = 1;

//variable which will contain sensor information
int data;

void setup() {
// setup pin modes

pinMode(rxPin1, INPUT);

pinMode(txPin1, OUTPUT);

void loop() {

//transmitting get command to sensor via TX pin

Serial.write(0x7B 0x59 0x09 0x01 0x5A 0x30 0x00 0x01 0xFE 0x3540 0x7D); //THIS IS WHERE IT

//SAYS THE PROBLEM IS

// reads in rxPin1 signal in serial monitor

data = Serial.read();

// print as an ASCII-encoded decimal

Serial.println(data);

//time delay in ms before rerunning main loop and reprompting sensor

delay(100);

}

have a read of the forum guidelines which are stickies at the top of every section. You need to edit your post to include code tags and you need to copy the entire error from the ide with the little button provided (bottom right) and paste it, also inside code tags.

Look at the 3rd example of serial write in the reference.

Basically what you are doing is like Serial.write('a' 'b' 'c' 'd' 'e' 'f'). You're giving too many arguments to the write function, and there isn't even a comma between them.
What you need to do is first define an array, then give that array to the function. Example:

char data[5] = {0x01, 0x02, 0x03, 0x04, 0x05};
Serial.write(data);
char data[5] = {0x01, 0x02, 0x03, 0x04, 0x05};
Serial.write(data, sizeof(data));

Thank you all for the quick response. I'll work on it a post the results

Serial.write(0x7B 0x59 0x09 0x01 0x5A 0x30 0x00 0x01 0xFE 0x35 0x40 0x7D);

becomes:

static byte msg[] = {0x7B, 0x59, 0x09, 0x01, 0x5A, 0x30, 0x00, 0x01, 0xFE, 0x35, 0x40, 0x7D};
  Serial.write(msg, sizeof msg);