ea123:
Hi,
another solution is defining a union:union Number
{
long num;
byte barray[4];
} NN;
then set the long field and get the byte array:
NN.num = 123466L;
byte b0 = NN.data[0];
byte b1 = NN.data[1];
byte b2 = NN.data[2];
byte b3 = NN.data[3];
Hmm I thought I'm not that stupid but can you help me to implement this.
What is in the data array?
EDIT:
Ok found something I cahnged the code to:
union Number
{
long num;
byte barray[4];
}
NN;
NN.num = 115730L;
byte b0 = NN.barray[0];
byte b1 = NN.barray[1];
byte b2 = NN.barray[2];
byte b3 = NN.barray[3];
Now it is working perfectly but how can I ad an 'L' to a long integer?
Thx
Andy