This is an example program that actually allows the car to race using the FRDM-TFC library!

Dependencies:   FRDM-TFC

Fork of TFC-RACING-DEMO by Daniel Hadad

Revision:
1:2ca599933725
Parent:
0:98e98e01a6ce
--- a/main.cpp	Sun Apr 20 03:33:03 2014 +0000
+++ b/main.cpp	Mon Apr 28 15:05:37 2014 +0000
@@ -21,100 +21,8 @@
 void DemoProgram()
 {
   uint32_t i,j,t = 0;
-  float ReadPot0, ReadPot1;
-
-
-  //This Demo program will look at the middle 2 switch to select one of 4 demo modes.
-  //Let's look at the middle 2 switches
-  switch((TFC_GetDIP_Switch()>>1)&0x03)
-  {
-  default:
-  case 0 :
-      //Demo mode 0 just tests the switches and LED's
-      if(TFC_PUSH_BUTTON_0_PRESSED)
-          TFC_BAT_LED0_ON;
-      else
-          TFC_BAT_LED0_OFF;
-      
-      if(TFC_PUSH_BUTTON_1_PRESSED)
-          TFC_BAT_LED3_ON;
-      else
-          TFC_BAT_LED3_OFF;
-      
-      
-/*      if(TFC_GetDIP_Switch()&0x01)
-          TFC_BAT_LED1_ON;
-      else
-          TFC_BAT_LED1_OFF;
-      
-      if(TFC_GetDIP_Switch()&0x08)
-          TFC_BAT_LED2_ON;
-      else
-          TFC_BAT_LED2_OFF; */
-      
-      break;
-          
-  case 1:
-     TFC_HBRIDGE_DISABLE;
-                    
-     // if (TFC_HBRIDGE_ENABLED) {
-        
-    //    TFC_HBRIDGE_ENABLED = false;
-    //  }
+ // float ReadPot0, ReadPot1;
 
-      //Demo mode 1 will just move the servos with the on-board potentiometers
-      if(TFC_Ticker[0]>=20) // every 40mS...
-      {
-          TFC_Ticker[0] = 0; //reset the Ticker
-          //update the Servos
-          ReadPot0 = TFC_ReadPot(0);
-          ReadPot1 = TFC_ReadPot(1);
-          TFC_SetServo(0,ReadPot0);
-          TFC_SetServo(1,ReadPot1);
-          TERMINAL_PRINTF("Pot0 = %1.2f\r\n", ReadPot0);
-      //    TERMINAL_PRINTF("Pot1 = %1.2f\r\n", ReadPot1);
-      }
-      //Let's put a pattern on the LEDs
-      if(TFC_Ticker[1] >= 125) // every 250mS... cycle through LEDs
-      {
-          TFC_Ticker[1] = 0;
-          t++;
-          if(t>4)
-          {
-              t=0;
-          }           
-          TFC_SetBatteryLED_Level(t);
-      }
-      
-      TFC_SetMotorPWM(0,0); //Make sure motors are off 
-      TFC_HBRIDGE_DISABLE;
-
-      break;
-      
-  case 2 :
-      TFC_HBRIDGE_ENABLE;
-     
-      ReadPot0 = TFC_ReadPot(0);
-      ReadPot1 = TFC_ReadPot(1);
- //     TERMINAL_PRINTF("Pot0 = %1.2f\n", ReadPot0);
- //     TERMINAL_PRINTF("Pot1 = %1.2f\n", ReadPot1);
-      TFC_SetMotorPWM(ReadPot0,ReadPot1);
-              
-      //Let's put a pattern on the LEDs
-      if(TFC_Ticker[1] >= 125)
-          {
-              TFC_Ticker[1] = 0;
-                  t++;
-                  if(t>4)
-                  {
-                      t=0;
-                  }           
-              TFC_SetBatteryLED_Level(t);
-          }
-      break;
-  
-  case 3 :
-      //Demo Mode 3 will be in Freescale Garage Mode.  It will beam data from the Camera to the 
       //Labview Application
       //note that there are some issues 
       if(TFC_Ticker[0]>1000 && TFC_LineScanImageReady>0) // every 2s ...
@@ -143,31 +51,8 @@
                       
                   }
                   wait_ms(10);
-               }
-              
-     /*          for(i=0;i<8;i++) // print one line worth of data (128) from Camera 1 ??
-               {
-                    for(j=0;j<16;j++)
-                     {
-                       TERMINAL_PRINTF("0x%X",TFC_LineScanImage1[(i*16)+j]);
-                      
-                       if((i==7) && (j==15))  // when last data reached put in line return
-                           TERMINAL_PRINTF("\r\n",TFC_LineScanImage1[(i*16)+j]);
-                       else
-                           TERMINAL_PRINTF(",",TFC_LineScanImage1[(i*16)+j]);
-                      }   
-                      
-                      wait_ms(10);  
-              }      */                                 
-                  
-          }
-          
-
-
-      break;
-  } // end case
-
-}
+               }                 
+}}
 
  
 int main()