Hex array not working but non array works


does know why works

code: [select]

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

  delay(1000);

  serial.write(0x03);
  delay(2);
  serial.write(0x07);
  delay(2);
  serial.write(0xd0);
  delay(100);
  serial.write(0x07);
  delay(2);
  serial.write(0x00);
  delay(2);
  serial.write(0x64);
  delay(100);
  serial.write(0x0f);
  delay(2);
  serial.write(0x2a);
  delay(100);
 
}

void loop()

 
}


but not work?
code: [select]

byte message[] = {0x03,0x07,0xd0,0x07,0x00,0x64,0x0f,0x2a};

 
void setup()
{
 serial.begin(9600);
 delay(1000);

 for (int i=0; i<7; i++)
  {
   serial.write(message[i]);
   delay(2);
  }   
}

void loop()
{
 
}


i'm not having luck here.

for definition of work?

the 2 codes not same. while values are, intervals between writes not.

what sending data to? interval matter? apparently does.


Arduino Forum > Using Arduino > Programming Questions > Hex array not working but non array works


arduino

Comments

Popular posts from this blog

DHT11 Time out error using v0.4.1library

Sketch upload fails with Java error (___REMOVE___/bin/avrdude)!

Arduino Uno + KTY81/210 temperature sensor