Serial, sending entire byte array


hello, have problem sending data through serial arduino.
when try send data winaplication, have following sniffer log(free serial monitor), see attachment. (there string sent entire data)
when sending using arduino, seems sends each byte apart, see attachment.

ps:
1. serial ports virtual, i'm using virtual serial ports driver xp
2. combination winapp(server) + winapp(clinet) - works fine.
3. i'm using proteus emulate arduino.

code: [select]

void setup() {                
 serial.begin(9600);
}

void loop() {
 //20051010bb
 byte cmd[]={0x20,0x05,0x10,0x10,0xbb};
 serial.write(cmd,sizeof(cmd));

 delay(3000) ;
}





try this, should loop thru of array cmd[]

code: [select]
  //20051010bb
  byte cmd[]={0x20,0x05,0x10,0x10,0xbb};
  byte x;

void setup() {               
  serial.begin(9600);
}

void loop() {
for (x =0; x<sizeof(cmd); x=x+1){
  serial.write(cmd[x]);
}
  delay(3000) ;  // why need this?
}


Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > Serial, sending entire byte array


arduino

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

How to format a Get Request

avrdude: verification error, first mismatch at byte 0x0000 0x0c != 0x62