Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>This function listens for a message and executes code accordingly.</summary>
- /// <param name="message">The message to analyse.</param>
- /// <remarks>This function should be performed on all incoming serial data as soon as it arrives</remarks>
- void listener(int message[]){
- int len = message.length - 1;
- int header = message[0];
- int args[len];
- for(int i = 1; i < len; i++){
- args[i - 1] = message[i];
- }
- switch(header){
- case 255:
- //do action corresponding to command
- break;
- case 254:
- //do action
- break;
- //...
- case 248:
- //do action
- break;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement