Pages: [1]   Go Down
Author Topic: having problem to recieve data from CMUcam4  (Read 841 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

#include <CMUcam4.h>
#include <CMUcom4.h>

#define RED_MIN 0
#define RED_MAX 100
#define GREEN_MIN 0
#define GREEN_MAX 100
#define BLUE_MIN 0
#define BLUE_MAX 100

#define LED_BLINK 5 // 5 Hz
#define WAIT_TIME 5000 // 5 seconds

int led=10;

CMUcam4 cam(CMUCOM4_SERIAL);

void setup()
{
  cam.begin();

  // Wait for auto gain and auto white balance to run.

  cam.LEDOn(LED_BLINK);
  delay(WAIT_TIME);

  // Turn auto gain and auto white balance off.

  cam.autoGainControl(false);
  cam.autoWhiteBalance(false);

  cam.LEDOn(CMUCAM4_LED_ON);

  pinMode(led, OUTPUT);

}

void loop()
{
  CMUcam4_tracking_data_t data;

  cam.trackColor(RED_MIN, RED_MAX, GREEN_MIN, GREEN_MAX, BLUE_MIN, BLUE_MAX);

  for(;; )
  {
    cam.getTypeTDataPacket(&data); // Get a tracking packet.

    if (data.pixels>0)// color is seen
    digitalWrite(led,1);

    else
    digitalWrite(led,0);

    // Process the packet data safely here.
  }

  // Do something else here.
}

i connect the camera to the arduino to observe the detection.

i connect the
tx(arduino) to rx (cam)-white cable
rx(arduino) to tx (cam)- yellow cable
gnd to gnd- orange cable

when i make the camera to detect nothing, red led on camera off but the led on arduino still on.
another problem is even i do not connect the camera to the arduino, the led on arduino is on. it seem that arduino cannot get the data from camera. can anyone help me?

thanks
« Last Edit: November 19, 2012, 12:01:58 am by csseng » Logged

Pages: [1]   Go Up
Jump to: