Project

General

Profile

Revision 1983

Modified barcodes again - after reading the first barcode, should work like normal.

View differences:

trunk/code/projects/linefollowing/lineFollow.c
17 17
#define CODESIZE 5 
18 18
#define LINE_COLOR 200
19 19

  
20
/**
21
 * Helps with debugging.
22
 * 0 - no debug output.
23
 * 1 - print out buckets
24
 * 2 - print out line sensor readings
25
 */
26
#define DBG_LINEFOLLOW 0
20 27

  
21 28
int countHi = 0;
22 29
int countLo = 0;
......
309 316
    lastReadingsPtr[i] = (lastReadingsPtr[i]+1) % NUM_READINGS;
310 317
    numLast[i][curColor]++;
311 318

  
312
    /*usb_puts("LP[");
313
    usb_puti(i);
314
    usb_puts("]: ");
315
    usb_puti(lastReadingsPtr[i]);
316
    usb_puts(", oldest: ");
317
    usb_puti(oldest);
318
    usb_puts(", Totals: ");
319

  
320
    for(int j=0; j<=3; j++)
319
    if(DBG_LINEFOLLOW == 1)
321 320
    {
322
        usb_puts("[");
323
        usb_puti(j);
321
        usb_puts("LP[");
322
        usb_puti(i);
324 323
        usb_puts("]: ");
325
        usb_puti(numLast[i][j]);
326
        usb_puts(" ");
324
        usb_puti(lastReadingsPtr[i]);
325
        usb_puts(", oldest: ");
326
        usb_puti(oldest);
327
        usb_puts(", Totals: ");
328

  
329
        for(int j=0; j<=3; j++)
330
        {
331
            usb_puts("[");
332
            usb_puti(j);
333
            usb_puts("]: ");
334
            usb_puti(numLast[i][j]);
335
            usb_puts(" ");
336
        }
337
        usb_puts("\t ");
338
        usb_puts("\n");
327 339
    }
328
    usb_puts("\t ");*/
329
    //usb_puts("\n");
330 340
}
331 341

  
332 342
void updateBarCode()
......
357 367
            curColor = LGREY;
358 368
        }
359 369

  
360
        /*usb_puts("Read: ");
361
        usb_puti(curReading);
362
        usb_puts("\t ");*/
363

  
370
        // Keep track of this reading
364 371
        addToBuckets(curColor, i);
365 372

  
366 373
        // Just an error check
......
388 395
            curColor = BAD_READING;
389 396
        }
390 397

  
391
        /*switch(curColor)
398
        // Print out the current reading and label, if in debug mode
399
        if(DBG_LINEFOLLOW == 2)
392 400
        {
393
            case LBLACK: usb_puts("LBLACK. "); break;
394
            case LGREY: usb_puts("LGREY. "); break;
395
            case LWHITE: usb_puts("LWHITE. "); break;
401
            switch(curColor)
402
            {
403
                case LBLACK: usb_puts("LBLACK.\t"); break;
404
                case LGREY: usb_puts("LGREY.\t\t"); break;
405
                case LWHITE: usb_puts("LWHITE.\t\t\t"); break;
406
            }
407
            usb_puti(curReading);
408
            usb_puts("\n");
396 409
        }
397
        usb_puti(curReading);
398
        usb_puts("\n");*/
399 410
    
400 411
        if(curColor != BAD_READING)
401 412
        {
......
412 423
            }
413 424
            else if(curColor == LWHITE)
414 425
            {
415
                if(!isReset[i] && (bitColor[i] != LWHITE))
426
                if(!isReset[i])
416 427
                {
417 428
                    barCode[i][barCodePosition[i]++] = 
418 429
                        (bitColor[i] == LBLACK) ? 1 : 0;
trunk/code/projects/linefollowing/Makefile
11 11
USE_WIRELESS = 1
12 12

  
13 13
# com1 = serial port. Use lpt1 to connect to parallel port.
14
AVRDUDE_PORT = $(shell if uname -s |grep -i w32 >/dev/null; then echo 'COM4:'; else echo '/dev/ttyUSB1'; fi)
14
AVRDUDE_PORT = $(shell if uname -s |grep -i w32 >/dev/null; then echo 'COM4:'; else echo '/dev/ttyUSB0'; fi)
15 15

  
16 16
else
17 17
COLONYROOT := ../$(COLONYROOT)

Also available in: Unified diff