Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: CameraC328 SDFileSystem WIZnetInterface mbed-src
Diff: main.cpp
- Revision:
- 1:7d428f360a0a
- Parent:
- 0:27fe09e9f405
- Child:
- 2:c469227cb913
--- a/main.cpp Tue Jul 21 17:33:35 2015 +0000
+++ b/main.cpp Tue Jul 21 23:52:52 2015 +0000
@@ -58,12 +58,12 @@
char gMsgBuf[10];
int User_Keyboard_MSG_Cnt;
/* CAMERA */
-static const int CAPTURE_FRAMES = 1;
static FILE *fp_jpeg;
char fname[32];
char fname_server[16];
+char fnamecnt=0;
CameraC328 camera(PA_13, PA_14, CameraC328::Baud115200);
-/* Fuction*/
+/* Function*/
char* User_Keyboard_MSG(void);
int pportc(char * arg);
void jpeg_callback(char *buf, size_t siz);
@@ -73,8 +73,6 @@
int main() {
char Msg_c;
- int size;
- int remain_datasize;
int remain_filesize;
int send_byte;
@@ -101,7 +99,8 @@
//while 1
while(true)
{
- if(pc.getc()==0x31){
+ Msg_c = pc.getc();
+ if(Msg_c==0x31){
test_jpeg_snapshot_picture();
ftpclientrun = true;
@@ -132,17 +131,15 @@
int n = FTP_CONTROL_SOCK.receive(buf, sizeof(buf));
if (n <= 0) break;
buf[n] = '\0';
- pc.printf("Received message from server: '%s' \n", buf);
+ pc.printf("\r\nReceived message from server: '%s'\r\n", buf);
//buf if
if (!strncmp(buf, "220", 3)){
- pc.printf("\r\nInput your User ID > ");
FTP_CONTROL_SOCK.send(USER, sizeof(USER)-1);
//FTP_CONTROL_SOCK.send(gMsgBuf, User_Keyboard_MSG_Cnt-1);
FTP_CONTROL_SOCK.send(END, sizeof(END)-1);
}
else if(!strncmp(buf, "331", 3)){
- pc.printf("\r\nInput your Password > ");
FTP_CONTROL_SOCK.send(PASS, sizeof(PASS)-1);
//FTP_CONTROL_SOCK.send(gMsgBuf, User_Keyboard_MSG_Cnt-1);
FTP_CONTROL_SOCK.send(END, sizeof(END)-1);
@@ -275,9 +272,9 @@
err = camera.sync();
if (CameraC328::NoError == err) {
- printf("[ OK ] : CameraC328::sync\n");
+ printf("[ OK ] : CameraC328::sync\r\n");
} else {
- printf("[FAIL] : CameraC328::sync (Error=%02X)\n", (int)err);
+ printf("[FAIL] : CameraC328::sync (Error=%02X)\r\n", (int)err);
}
}
void test_jpeg_snapshot_picture(void) {
@@ -289,25 +286,26 @@
err = camera.init(CameraC328::Jpeg, CameraC328::RawResolution80x60, CameraC328::JpegResolution320x240);
#endif
if (CameraC328::NoError == err) {
- printf("[ OK ] : CameraC328::init\n");
+ printf("[ OK ] : CameraC328::init\r\n");
} else {
- printf("[FAIL] : CameraC328::init (Error=%02X)\n", (int)err);
+ printf("[FAIL] : CameraC328::init (Error=%02X)\r\n", (int)err);
}
- for (int i = 0; i < CAPTURE_FRAMES; i++) {
- snprintf(fname, sizeof(fname), "/sd/jpss%04d.jpg", i);
- for(int i = 0; i < 12; i++){
- fname_server[0+i] = fname[4+i];
- }
- fp_jpeg = fopen(fname, "w");
+
+ snprintf(fname, sizeof(fname), "/sd/jpss%04d.jpg", fnamecnt);
+ fnamecnt++;
+ for(int i = 0; i < 12; i++){
+ fname_server[0+i] = fname[4+i];
+ }
+ fp_jpeg = fopen(fname, "w");
- err = camera.getJpegSnapshotPicture(jpeg_callback);
- if (CameraC328::NoError == err) {
- printf("[ OK ] : CameraC328::getJpegSnapshotPicture\n");
- } else {
- printf("[FAIL] : CameraC328::getJpegSnapshotPicture (Error=%02X)\n", (int)err);
- }
+ err = camera.getJpegSnapshotPicture(jpeg_callback);
+ if (CameraC328::NoError == err) {
+ printf("[ OK ] : CameraC328::getJpegSnapshotPicture\r\n");
+ } else {
+ printf("[FAIL] : CameraC328::getJpegSnapshotPicture (Error=%02X)\r\n", (int)err);
+ }
- fclose(fp_jpeg);
- }
+ fclose(fp_jpeg);
+
}
\ No newline at end of file