Grove Serial Camera - Serial communication

Grove is a modulated, ready-to-use tool set.
Much like Lego, it takes a building block approach to assembling electronics.

Moderators: lily.li, violet, salmanfarisvp, jeremy882, crail.lyu969

Post Reply
festhead
Pre-kindergarten
Pre-kindergarten
Posts: 1
Joined: Wed Aug 26, 2009 3:40 pm

Grove Serial Camera - Serial communication

Post by festhead » Fri Mar 23, 2012 6:01 pm

Hi,
I'm using the example given in the wiki to communicate with the Grove Serial Camera through the serial port.

I reorganized the given example to the following:

Code: Select all

#include <SoftwareSerial.h>


#define BAUDRATE 115200
#define LED_PIN  13

char length[] = {
  0x00,0x00,0x00,0x00};
char cmdRST[] = {
  0x56,0x00,0x26,0x00};//reset for at least 10ms (delay(10))
char cmdCAP[] = {      
  0x56,0x00,0x36,0x01,0x00};//take picture
char cmdGetLen[] = {
  0x56,0x00,0x34,0x01,0x00};//return:0x76 0x00 0x34 0x00 0x04 + 4bytes(image size) 
char cmdGetData[] = {        //get image data from the buffer of the camera ( 2 last byte * 0.01ms = interval time)
  0x56,0x00,0x32,0x0c,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a}; 
char cmdStop[] = {
  0x56, 0x00, 0x36, 0x01, 0x03};
char cmdConti[] = {
  0x56,0x00,0x36,0x01,0x02};//continue
char cmdPowSaf[] = {
  0x56, 0x00, 0x3e, 0x03, 0x00, 0x01, 0x01};
char cmdPowOn[] = {
  0x56, 0x00, 0x3e, 0x03, 0x00, 0x01, 0x00};
   

SoftwareSerial Camera(4,3); //rx,tx
  
void setup() {
  Serial.begin(BAUDRATE);
  Camera.begin(BAUDRATE);


}

void loop() {

  Camera.listen();
  Camera.flush();
  for(int i=0;i < 4;i ++){
    Camera.print(cmdRST[i]);//reset the camera
  }
  delay(10);

  while(Camera.available() > 0){
     int data = Camera.read();
     Serial.println(data,HEX);
  }
  
 
Serial.println("end");
   while(1) {
    if(Camera.available()>0) {
       int data = Camera.read();
       Serial.println(data,HEX);  
    } 
   }
}
I get the following output on my serial monitor

Code: Select all

BA
C0
CB
40
E0
end
AA
34
F3
1B
59
83
C5
96
D8
CC
43
F1
E1
DA
5C
6B
64
3D
CF
CB
90
59
6E
AD
36
DB
48
7C
6D
B7
96
5B
99
AD
99
5A
AF
93
90
B6
B6
6F
BF
B9
85
C5
CF
4C
65
61
F1
A5
F7
6E
2E
B4
9B
8B
AD
AC
FE
I know this is a reaction from the camera, since when i disconnect it, no output is given.

The expected result is

Code: Select all

76
0
26
0
end
Any help on this?
Thanks!

yuriq
Elementary-3
Elementary-3
Posts: 383
Joined: Wed Dec 07, 2011 5:33 pm

Re: Grove Serial Camera - Serial communication

Post by yuriq » Mon Mar 26, 2012 4:19 pm

Dear customer,

Sorry we are not support with software.
Hope you can solve your problem.

Best regards,

Yuri

Post Reply