Go Down

Topic: having problem to recieve data from CMUcam4 (Read 966 times) previous topic - next topic

csseng

Nov 19, 2012, 06:00 am Last Edit: Nov 19, 2012, 06:01 am by csseng Reason: 1
#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

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy