Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@00RD00000000*
- String texto;
- boolean flag[10];
- char c;
- int var;
- byte Temp;
- void setup()
- {
- Serial.begin(9600);
- pinMode(13,OUTPUT);
- }
- void loop()
- {
- while(Serial.available())
- {
- c= Serial.read();
- if (c == '@')
- {
- Temp = c;
- }
- else
- {
- if (c!='*')
- {
- Temp = Temp^c;
- }
- //Serial.println(Temp,HEX);
- }
- if (c=='@' || flag[0]==true) //inicio da String
- {
- flag[0]=true;
- texto += c;
- }
- if (c=='*') // fim da String
- {
- //calcular FCS
- Serial.print(texto); //imprimir na serial mais o FCS
- Serial.print (" FCS ");
- Serial.println(Temp,HEX);
- texto="";
- flag[0]=false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement