Code for autonomous ground vehicle, Data Bus, 3rd place winner in 2012 Sparkfun AVC.
Dependencies: Watchdog mbed Schedule SimpleFilter LSM303DLM PinDetect DebounceIn Servo
Camera.cpp
00001 #include "mbed.h" 00002 #include "Camera.h" 00003 00004 Camera::Camera(PinName tx, PinName rx): 00005 serial(tx, rx) 00006 { 00007 serial.baud(115200); 00008 00009 return; 00010 } 00011 00012 void Camera::start() 00013 { 00014 serial.attach(this, &Camera::receive, Serial::RxIrq); 00015 00016 // ping 00017 // should now get ACK\r or NACK\r 00018 // send colormap here 00019 // should now get ACK\r or NACK\r 00020 // disable white balance 00021 // should now get ACK\r or NACK\r 00022 serial.printf("ET\r\n"); 00023 // should now get ACK\r or NACK\r 00024 return; 00025 } 00026 00027 00028 void Camera::receive() 00029 { 00030 while (serial.readable()) { 00031 char c = serial.getc(); 00032 fprintf(stdout, "%c\n", c); 00033 } 00034 return; 00035 } 00036 00037 00038 /* 00039 * (Byte 0: 0x0A – Indicating the start of a tracking packet 00040 * Byte 1: Number of trac k ed objects (0x00 – 0x08 are valid) 00041 * Byte 2: Color of object tracked in bounding box 1 00042 * Byte 3: X upper left corner of bounding box 1 00043 * Byte 4: Y upper left corner of bouding box 1 00044 * Byte 5: X lower right corner of boudning box 1 00045 * Byte 6: Y lower right corner of boudning box 1 00046 * Byte 7: Color object tracked in bound box 2 00047 * ... 00048 * Byte x: 0xFF (indicates the end of line, and will be sent after all tracking info 00049 * for the current frame has been sent) 00050 */ 00051 void Camera::parse(char c) 00052 { 00053 00054 return; 00055 } 00056
Generated on Tue Jul 12 2022 14:09:25 by 1.7.2