Austin Community College initial line follower program for Freescale car. This is based upon the FRDM-TFC code at mbed.org.

Dependencies:   mbed

Fork of FRDM-TFC by Eli Hughes

Austin Community College - Initial Specs for FRDM-TFC line following car.

This uses the fine library by ELI HUGHES.

Our goal here is to provide the simplest line-follower as a quick car checkout.

First, we limit the run duration for the car, so that you can catch it, if necessary. Right DIP switch (4) sets run time. 0 => 5 sec, 1 => 10 sec.

We provide simple speed selection with the other three DIP switches. I recommend 001 as the slowest real speed, (000 is stop, of course). DIP switches 1 2 3 make a 3 bit speed. 1 is msb, 3 is lsb

The car won't start until you press and release the driver's side PB. Left PB (TFC_PUSH_BUTTON_1) is permissive GO on release using left 3 DIPs for speed 0-7.

The car will stop when the passenger side PB is pressed. Right PB is STOP - TFC_PUSH_BUTTON_0

TFC_Ticker[3] is our run time counter. Like the Code Warrior edition, we use msec tickers.

Left (Driver side) trim pot 1 can be used to trim static steering servo Right trim pot 0 can be used to offset line camera

Back LED reflects drive motor status. The top three are not currently used.

Revision:
4:8a4a3fc59e57
Parent:
3:23cce037011f
Child:
5:9d36b4c896e1
--- a/main.cpp	Thu Aug 15 23:26:19 2013 +0000
+++ b/main.cpp	Wed Sep 04 02:48:20 2013 +0000
@@ -127,10 +127,12 @@
             
             case 3 :
             
+                uint32_t NumCameras = 1;     // Enter here how many line scan cameras hooked up
+         
                 //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)
                     {
                      TFC_Ticker[0] = 0;
@@ -145,30 +147,42 @@
                         
                          TFC_SetBatteryLED_Level(t);
                         
+                         // camera 1
                          for(i=0;i<8;i++)
                          {
                             for(j=0;j<16;j++)
                             {
-                                 TERMINAL_PRINTF("%X,",TFC_LineScanImage0[(i*8)+j]);
-                                
+                               TERMINAL_PRINTF("%X",TFC_LineScanImage0[(i*16)+j]);
+
+                               if (NumCameras == 1)
+                               {
+                                 if((i==7)&&(j==15))
+                                     TERMINAL_PRINTF("\r\n",TFC_LineScanImage0[(i*16)+j]);
+                                 else
+                                     TERMINAL_PRINTF(",",TFC_LineScanImage0[(i*16)+j]);
+                               }                  
+
                             }
                             wait_ms(10);
                          }
-                        
-                         for(i=0;i<8;i++)
-                         {
-                              for(j=0;j<16;j++)
+                         
+                         // camera 2
+                         if (NumCameras == 2)
+                         {                        
+                            for(i=0;i<8;i++)
+                            {
+                               for(j=0;j<16;j++)
                                {
-                                 TERMINAL_PRINTF("%X",TFC_LineScanImage1[(i*8)+j]);
+                                  TERMINAL_PRINTF("%X",TFC_LineScanImage1[(i*16)+j]);
                                 
-                                 if((i*8)+j==127)
-                                     TERMINAL_PRINTF("\r\n",TFC_LineScanImage1[(i*8)+j]);
-                                 else
-                                     TERMINAL_PRINTF(",",TFC_LineScanImage1[(i*8)+j]);
-                                }   
-                                
-                                wait_ms(10);  
-                        }                                       
+                                  if((i==7)&&(j==15))
+                                     TERMINAL_PRINTF("\r\n",TFC_LineScanImage1[(i*16)+j]);
+                                  else
+                                     TERMINAL_PRINTF(",",TFC_LineScanImage1[(i*16)+j]);
+                               }        
+                               wait_ms(10);  
+                            }
+                         }                                     
                             
                     }