//arduino用来发送串口数组,用char来定义数组,用Serial.write(numdata1,sizeof(numdata1));
//来发送数组
#include <Arduino.h>
#include <Wire.h>
#include <SoftwareSerial.h>
int j=40;
char numdata1[]={0xAA,0x01,0x01,0x00,0x50,0x3c,0x04};
char numdata2[]={0xAA,0x02,0x02,0x01,0x50,0x3c,0x04};
void _loop()
{
}
void _delay(float seconds)
{
long endTime = millis() + seconds * 1000;
while(millis() < endTime)_loop();
}
void setup()
{
Serial.begin(115200);
}
void loop()
{
for(j=numdata1[4];j>1;j--)
{
numdata1[6]=j ;
//Serial.println(numdata1);
Serial.write(numdata1,sizeof(numdata1));
_delay(3);
}
for(j=numdata2[4];j>1;j--)
{
numdata2[6]=j ;
//Serial.println(numdata2);
Serial.write(numdata2,sizeof(numdata2));
_delay(3);
}
}