how can i send the file form?
kim-hyeonjun opened this issue · comments
When you do Iridium satellite communication by sbdsend in the code above,i can only receive the first line above.
The above is a simple example, and to be exact, I want to call up the csv file stored on the sd card and save it in variable a and see it on my computer using Iridium satellite communication, but I can't receive the first line whenever I communicate. Can't we get an entry from iridium communication? Or I'd appreciate it if you could give me an answer.
There is a code below.
`#include <IridiumSBD.h>
#define IridiumSerial Serial3
#define DIAGNOSTICS false // Change this to see diagnostics
#include <SD.h>
#include <SPI.h>
File myFile;
int CS_PIN = 53 ; // CS pin
String inputString;
int count = 1;
int i;
// Declare the IridiumSBD object
IridiumSBD modem(IridiumSerial);
void initializeSD() {
Serial.println("Initializing SD card...");
pinMode(CS_PIN, OUTPUT);
if (SD.begin()) {
Serial.println("SD card is ready to use.");
} else {
Serial.println("SD card initialization failed");
return;
}
} // =============================
void Read_Data() {
myFile = SD.open("Sample.txt");
if (myFile) {
while (myFile.available()) {
char Data = (char)myFile.read() ;
inputString += Data;
count++;
// read file until no more
}
Serial.println("save OK!");
myFile.close(); // close the file:
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
} // =================
void setup()
{
int signalQuality = -1;
int err;
// Start the console serial port
Serial.begin(115200);
while (!Serial);
pinMode(CS_PIN, OUTPUT);
initializeSD(); // 1 단계
Read_Data() ; // 2 단계
i=count;
char h[i] = {0};
inputString.toCharArray(h,i);
Serial.println(h);
// Start the serial port connected to the satellite modem
IridiumSerial.begin(19200);
// Begin satellite modem operation
Serial.println("Starting modem...");
err = modem.begin();
if (err != ISBD_SUCCESS)
{
Serial.print("Begin failed: error ");
Serial.println(err);
if (err == ISBD_NO_MODEM_DETECTED)
Serial.println("No modem detected: check wiring.");
return;
}
// Example: Print the firmware revision
char version[12];
err = modem.getFirmwareVersion(version, sizeof(version));
if (err != ISBD_SUCCESS)
{
Serial.print("FirmwareVersion failed: error ");
Serial.println(err);
return;
}
Serial.print("Firmware Version is ");
Serial.print(version);
Serial.println(".");
// Example: Test the signal quality.
// This returns a number between 0 and 5.
// 2 or better is preferred.
err = modem.getSignalQuality(signalQuality);
if (err != ISBD_SUCCESS)
{
Serial.print("SignalQuality failed: error ");
Serial.println(err);
return;
}
Serial.print("On a scale of 0 to 5, signal quality is currently ");
Serial.print(signalQuality);
Serial.println(".");
// Send the message
Serial.print("Trying to send the message. This might take several minutes.\r\n");
err = modem.sendSBDText(h);
if (err != ISBD_SUCCESS)
{
Serial.print("sendSBDText failed: error ");
Serial.println(err);
if (err == ISBD_SENDRECEIVE_TIMEOUT)
Serial.println("Try again with a better view of the sky.");
}
else
{
Serial.println("Hey, it worked!");
}
}
void loop()
{
}
#if DIAGNOSTICS
void ISBDConsoleCallback(IridiumSBD *device, char c)
{
Serial.write(c);
}
void ISBDDiagsCallback(IridiumSBD *device, char c)
{
Serial.write(c);
}
#endif
`