Using A6C camera
A6C module from AiThinker has a built-in camera. It even has a LED to be used as flash (the yellow block aside the flat cable connector).
But how to control it for taking pictures and extract the image?
Answear: You do all that with AT commands. And within ATCommander you can do that with the click of a button.
AT command sequence:
>> AT+CAMSTART=1 --start the camera, 1 for highest resolution which is 640x480 pixels AT+CAMSTART=1 OK >> AT+CAMCFG=0,1 --enable flash LED AT+CAMCFG=0,1 OK >> AT+CAMCAP --take picture AT+CAMCAP +CAMCAP:14067 OK >> AT+CAMRD -- issue the module to output the JPG binary data AT+CAMRD Binary data.. OK
AT+CAMRD will make the binary JPG data to be dumped to the serial port. *But how to correctly parse it?
Solution is to wait till you receive a
OK\r\n line while recording the output from the module.
That is, you must extract the
Binary data.. middle part with the binary data.
So in C#, given the the output, you would take the middle slice of it as follow:
byte cmd_output = ...; bytes jpg_data = cmd_output.Skip(10).Take(exec.OutputBinary.Length - 20).ToArray();
For taking shots in ATCommander just use the Camera tab: