I am using Arduino and I am having difficulty sending a file all responses are returned as ok except for Send(“AT+FTPPUTFRMFS=“myFile””); my code is as followed:
#include <SoftwareSerial.h>
#include <SPI.h>
#include <SD.h>
String Arsp, Grsp;
SoftwareSerial gsm(2, 3); // RX, TX
File myFile;
void setup() {
Serial.begin(9600);
Serial.println("Testing GSM SIM800L");
gsm.begin(4800);
Serial.print("Initializing SD card...");
if (!SD.begin(10)) {
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done.");
Send(F("AT+CREG?"));
printScreen();
Send(F("AT+SAPBR=3,1,\"Contype\",\"GPRS\"" ));
printScreen();
Send(F("AT+SAPBR=3,1,\"APN\",\"internet\"" ));
printScreen();
Send(F("AT+SAPBR=1,1" ));
printScreen();
Send(F("AT+FTPCID=1" ));
printScreen();
Send(F("AT+FTPSERV=\"xxx\"" ));
printScreen();
Send(F("AT+FTPPORT=21 " ));
printScreen();
Send(F("AT+FTPUN=\"xxxx\"" ));
printScreen();
Send(F("AT+FTPPW=\"xxxx\"" ));
printScreen();
//myFile = SD.open("datalog.txt");
Send(F("AT+FTPPUTNAME=\"datalog.txt\""));
printScreen();
Send(F("AT+FTPPUTPATH=\"/\"" ));
printScreen();
File myFile = SD.open("datalog.txt");
Send("AT+FTPPUTFRMFS=\"myFile\"");
printScreen();
Send(F("AT+FTPPUTFRMFS?"));
printScreen();
/*Send(F("+FTPPUT: 1,0"));
printScreen();
Send(F("+FTPPUT: 0"));
printScreen();*/
myFile.close();
Send(F("AT+SAPBR=0,1"));
printScreen();
}
void loop(){}
void Send(String Command) {
gsm.println(Command);
//delay(t);
}
void printScreen() {
while (gsm.available() == 0) {}
if (gsm.available()) {
Grsp = gsm.readString();
Serial.println(Grsp);
}
}