hi..
i'm working on a project that needs to send CSV file (which has some data in it) from SD Card to FTP Server.. i'm using Icomsat V1.1 GSM Shield with Uno R3.. so far, i manage to communicate with the SD Card Shield and GSM Shield.. but, my problem is, after sending file to FTP Server, the file is empty.. i'm using GSM_Shield library, with Tx jumper is at 2 and Rx jumper is at 3.. noted that i have connected my GSM shield to 9VDC supply.. my code is as below:
#include "SIM900.h"
#include <SoftwareSerial.h>
#include <SD.h>
int numdata;
char inSerial[10];
int i=0;
const int chipSelect = 4;
char file_name [100]="2014627.csv";
char ftpputname [100];
File dataFile;
void setup()
{
Serial.begin(9600);
gsm.begin(9600);
pinMode(chipSelect, OUTPUT);
pinMode(10, OUTPUT);
if (!SD.begin(chipSelect))
{
Serial.println("Card failed, or not present");
return;
}
Serial.println("card initialized");
dataFile = SD.open("2014627.csv", FILE_READ);
if (dataFile)
{
Serial.println(" datalog.txt is opened in read mode.");
}
}
void loop()
{
gsm.SimpleWriteln("AT");
delay(150);
gsm.WhileSimpleRead();
gsm.SimpleWriteln("AT+CREG?");
delay(150);
gsm.WhileSimpleRead();
gsm.SimpleWriteln("AT+SAPBR=2,1");
delay(150);
gsm.WhileSimpleRead();
gsm.SimpleWriteln("AT+SAPBR=1,1");
delay(150);
gsm.WhileSimpleRead();
gsm.SimpleWriteln("AT+FTPCID=1");
delay(150);
gsm.WhileSimpleRead();
gsm.SimpleWriteln("AT+FTPSERV=\"ftpaddress\"");
delay(150);
gsm.WhileSimpleRead();
gsm.SimpleWriteln("AT+FTPUN=\"ftpusername\"");
delay(150);
gsm.WhileSimpleRead();
gsm.SimpleWriteln("AT+FTPPW=\"ftppassword\"");
delay(150);
gsm.WhileSimpleRead();
gsm.SimpleWriteln("AT+FTPPUTPATH=\"/ftpfolder/\"");
delay(150);
gsm.WhileSimpleRead();
dataFile = SD.open(file_name, FILE_READ);
sprintf(ftpputname, "AT+FTPPUTNAME=\"%s\"", file_name);
Serial.println(ftpputname);
gsm.SimpleWriteln(ftpputname);
delay(150);
gsm.WhileSimpleRead();
gsm.SimpleWriteln("AT+FTPPUT=1");
delay(30000);
gsm.WhileSimpleRead();
gsm.SimpleWriteln("AT+FTPPUT=2,0");
delay(3000);
gsm.WhileSimpleRead();
delay (30000);
}
please advise.. thanks .. ![]()