how to Serial.read() in HEX?
i have ifid device?
i send 0xaa,0xbb,0x02,0x20,0x22?
it should return card id in hex .
but receive can't read x.??.
unsigned char qingqiu[]={0xaa,0xbb,0x02,0x20,0x22};
void setup() {
serial.begin(19200);
}
void loop() {
serial.write(qingqiu,5);
delay(100);
string = "";
a+=serial.read();
serial.println(a);
serial.flush();
delay(1000);
}
i send 0xaa,0xbb,0x02,0x20,0x22?
it should return card id in hex .
but receive can't read x.??.
unsigned char qingqiu[]={0xaa,0xbb,0x02,0x20,0x22};
void setup() {
serial.begin(19200);
}
void loop() {
serial.write(qingqiu,5);
delay(100);
string = "";
a+=serial.read();
serial.println(a);
serial.flush();
delay(1000);
}
before use serial.read must make sure there read.
do serial.available call , read data when there data read.
do serial.available call , read data when there data read.
Arduino Forum > Using Arduino > Programming Questions > how to Serial.read() in HEX?
arduino
Comments
Post a Comment