In file included from protocol.ino:1:0:
/home/dproger/sketchbook/libraries/protocol/protocol.h: In function ‘void send()’:
/home/dproger/sketchbook/libraries/protocol/protocol.h:45:7: error: ‘Serial’ was not declared in this scope
Serial.print(comout[i]);
^
/home/dproger/sketchbook/libraries/protocol/protocol.h: In function ‘int get(unsigned char&, unsigned char&, unsigned char&, unsigned int&)’:
/home/dproger/sketchbook/libraries/protocol/protocol.h:49:8: error: ‘Serial’ was not declared in this scope
if (Serial.available())
^
// protocol.h (отрывок)
char comout[] = {0, 0, 0, 0, 0};
char comin[] = {0, 0, 0, 0, 0};
unsigned char bin[] = {1, 2, 4, 8, 16, 32, 64, 128};
void send(){
for(int i = 0; i < 5; i++)
Serial.print(comout[i]);
}
int get(unsigned char &d1, unsigned char &d2, unsigned char &d3, unsigned &d4){
if (Serial.available())
{
char c2[] = {0, 0, 0, 0, 0};
int i = 0;
while (Serial.available() > 0)
{
char temp;
temp = Serial.read();
if(i < 5)
c2[i] == temp;
}
if((i == 5) && (check(c2))){
for(int j = 0; i < 5; j++)
comin[j] = c2[j];
d1 = comin[0];
d2 = comin[1];
d3 = comin[2];
d4 = comin[3];
return 1;
}else{
return -1;
}
}
return 0;
}