while(Serial.available() > 0)
{
ck += char(Serial.read());
delay(2);
mark =1;
}
if(mark == 1)
{
if(ck==0x06A33A2EFF12){
fid = 0;
if(digitalRead(41)==HIGH){
delay(200);
fid = 1;
}else{
fid = 0;
}
switch(fid){
case 0: digitalWrite(41, LOW);break;
case 1: digitalWrite(41, HIGH);break;
}
delay(2);
}
}
ck = String("");
mark = 0;
串口接收16进制06A33A2EFF12后进入判断。调试的时候,出现一下错误。
zonghe:63: error: integer constant is too large for 'long' type
zonghe:79: error: integer constant is too large for 'long' type
zonghe:94: error: integer constant is too large for 'long' type
zonghe.ino: In function 'void loop()':
zonghe:63: error: invalid conversion from 'long long int' to 'const char*'
zonghe:63: error: initializing argument 1 of 'unsigned char String:perator==(const char*) const'
zonghe:79: error: invalid conversion from 'long long int' to 'const char*'
zonghe:79: error: initializing argument 1 of 'unsigned char String:perator==(const char*) const'
zonghe:94: error: invalid conversion from 'long long int' to 'const char*'
zonghe:94: error: initializing argument 1 of 'unsigned char String:perator==(const char*) const'