myxbee
Fork of XBEE by
SwitchCase.h
- Committer:
- FatCookies
- Date:
- 2016-11-03
- Revision:
- 2:983d482357b9
- Parent:
- 1:ce4058bc0913
File content as of revision 2:983d482357b9:
// Add commands you wish to implement to the switch statement and #define the command with the next unused letter of the alphabet // Please try to minimise the number of lines you add per command i.e. for adding a steer left command simply call steerLeft() which // you then define in a separate file. This will make it easier to keep track of the big picture of what other people are making // the car do. Also you should only need to edit this file and not the other two in this library. // To use the wireless comms simply #include "XBEE.h" // Create a serial object for the microcontroller being used. for the k64f(M4 board) do: Serial ArbitraryName(PTC17, PTC16); // Create an instance of XBEE passing by reference the serial object: XBEE xbee(&ArbitraryName); // In the infinite loop for the car add: xbee.checkForCommand(); This function passes any commands received through the switch case below. // This is all you need to get started. Additional functions you may wish to use can be found in the public section of the class in XBEE.h #define START 'A' #define STOP 'B' #define STATUSSTRING 'C' void XBEE::switchCase(char command) { switch(command){ case START: (*xbeeSerial).printf("Eeyyyy\0"); break; case STOP: break; case STATUSSTRING: test(); sendCommand("But how long is a string?\n"); break; default: sendCommand("Invalid Command Received\n"); break; } }