Hello
- Arduino UNO
- GPRS shield V2 de Seedstudio seeedstudio.com/wiki/GPRS_Shield_V2.0
- SD Card Shield V4 de Seedstudio seeedstudio.com/wiki/SD_Card_shield_V4.0
I try to send file from my sd card by ftp but no data are transmit, please HELP !!!
[code]#include <SoftwareSerial.h>
#include <String.h>
#include <SD.h>
File myFile;
SoftwareSerial mySerial(7, 8);
void setup()
{
mySerial.begin(19200);
Serial.begin(19200);
Serial.println(“Hello, INIT”);
delay(500);
//digitalWrite(9, HIGH);
//delay(1000);
//digitalWrite(9, LOW);
//Serial.println(“Sim900 ON”);
//delay(5000);
Serial.print(“Initializing SD card…”);
pinMode(10, OUTPUT);
if (!SD.begin(4)) {
Serial.println(“initialization SD failed!”);
return;
}
Serial.println(“initialization SD done.”);
Serial.println(“End of INIT”);
Serial.println(“ftp”);
myFile = SD.open(“test.txt”);
mySerial.println("AT+SAPBR=3,1,\"Contype\",\"GPRS\""); //Configures GPRS connection
delay(100);
ShowSerialData();
mySerial.println("AT+SAPBR=3,1,\"APN\",\"FREE\"");
delay(100);
ShowSerialData();
mySerial.println("AT+SAPBR=1,1");
delay(100);
ShowSerialData();
mySerial.println("AT+FTPCID=1"); //Selects profile 1 for FTP operations
delay(1000);
ShowSerialData();
mySerial.println("AT+FTPSERV=\"ftp.xxxx.com\""); //Configures FTP parameters
delay(2000);
ShowSerialData();
mySerial.println("AT+FTPPORT=21");
delay(2000);
ShowSerialData();
mySerial.println("AT+FTPUN=\"xxxx\"");
delay(2000);
ShowSerialData();
mySerial.println("AT+FTPPW=\"xxxxx\"");
delay(2000);
ShowSerialData();
mySerial.println("AT+FTPPUTNAME=\"test.txt\""); //Sets destiny file name
delay(2000);
ShowSerialData();
mySerial.println("AT+FTPPUTPATH=\"/\""); //Sets destiny file path
delay(2000);
ShowSerialData();
mySerial.println("AT+FTPPUT=1"); //Starts session
delay(2000);
ShowSerialData();
mySerial.println("+FTPPUT:1,1,1200");
delay(2000);
ShowSerialData();
mySerial.println("AT+FTPPUT=2,0");
delay(2000);
ShowSerialData();
mySerial.println("+FTPPUT:1,0");
delay(2000);
ShowSerialData();
}
void loop()
{
}
void ShowSerialData()
{
while(mySerial.available()!=0)
Serial.write(mySerial.read());
}[/code]
On my serveur I have the file but with 0 octet …
Answer on my serial:
[code]OK
AT+SAPBR=3,1,“APN”,“FREE”
OK
AT+SAPBR=1,1
+CME ERROR: 3
AT+FTPCID=1
OK
AT+FTPSERV=“ftp.xxxxx.com”
OK
AT+FTPPORT=21
OK
AT+FTPUN=“xxxx”
OK
AT+FTPPW=“xxxxx”
OK
AT+FTPPUTNAME=“test.txt”
OK
AT+FTPPUTPATH="/"
OK
AT+FTPPUT=1
OK
+FTPPUT:1,1,1200
+FTPPUT:1,1,1200
AT+FTPPUT=2,0
OK
+FTPPUT:1,0[/code]