|
|
要把陣列裡的數值做16進制輸出結果是了很久都還是跳下面這樣
- void setup() {
- // put your setup code here, to run once:
- Serial.begin(9600, SERIAL_7E1);
- Serial3.begin(9600, SERIAL_7E1);
-
- }
- void loop() {
- // put your main code here, to run repeatedly:
- writep();
- }
- void writep()
- {
- /* _____________________________________________________________
- * 封包格式 EOT 01 | STX | H/G | IID | address | data 8 | SET | ETX | BCC |
- | 02h | 'H' | '2' | 4byte | 8byte |'0''1'| 03h | >1Fh |
- */
- // | EOT| 01 | STX | HG |IID | Arddress | Data |SET | EXT | BCC |
- //byte wrequest[]={0x02, 0x48, 0x34, 0x30, 0x33, 0x30, 0x33, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x36, 0x34, 0x30, 0x30, 0x03, 0x7d}; //HEX
- byte wrequest[]={0x48, 0x41, 0x30, 0x33, 0x30, 0x33, 0x30, 0x30, 0x05, 0x2e};
- for (int a = 0; a < 10; a++)
- {
- Serial.write(wrequest[a]);
- Serial3.write(wrequest[a]);
- //delay(2);
- //delayMicroseconds(5000);
- }
- delay(1000);
- }
复制代码 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|