Adam Piekarski / XBEE

Fork of XBEE by GDP 4

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SwitchCase.h Source File

SwitchCase.h

00001 // Add commands you wish to implement to the switch statement and #define the command with the next unused letter of the alphabet
00002 // Please try to minimise the number of lines you add per command i.e. for adding a steer left command simply call steerLeft() which
00003 // 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
00004 // the car do. Also you should only need to edit this file and not the other two in this library.
00005 
00006 // To use the wireless comms simply #include "XBEE.h"
00007 // Create a serial object for the microcontroller being used. for the k64f(M4 board) do: Serial ArbitraryName(PTC17, PTC16);
00008 // Create an instance of XBEE passing by reference the serial object: XBEE xbee(&ArbitraryName);
00009 // In the infinite loop for the car add: xbee.checkForCommand(); This function passes any commands received through the switch case below.
00010 // 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
00011 
00012 #define START 'A'
00013 #define STOP 'B'
00014 #define STATUSSTRING 'C'
00015 void XBEE::switchCase(char command)
00016 {
00017     switch(command){
00018         case START:
00019         (*xbeeSerial).printf("Eeyyyy\0");
00020         
00021         break;
00022         case STOP:
00023         
00024         
00025         
00026         break;
00027         case STATUSSTRING:
00028         test();
00029         sendCommand("But how long is a string?\n");        
00030         break;
00031         
00032         
00033         
00034         
00035         default:
00036         sendCommand("Invalid Command Received\n");
00037         break;
00038         
00039         
00040         
00041         
00042         
00043         }
00044     
00045     
00046 }