Hi Paul,
below is the sender code installed on a Teensy 3.2. The TSD refers to an SD module modified to quarter speed, so that the SD reader will run reliably with a Teensy running at 96 mHz.
the receiver code runs on a Nano.
I was unable to get reliable transmission above 9600 bps. Maybe the problem is in the code, because if I'm just sending the data to a terminal it looks ok.
??
Receiver code:
/*
* This seems to work ok 3-1-16 jaf
*/
#define I2C_ADDRESS 0x3C
#include "SSD1306Ascii.h"
#include "SSD1306AsciiAvrI2c.h"
#include <SoftwareSerial.h>
#include <SPI.h>
#include <SD.h>
File dataFile;
SSD1306AsciiAvrI2c oled;
SoftwareSerial ss(4, 3);
void setup() {
ss.begin(9600);
Serial.begin(96s00);
Serial.print("this is the startup");
oled.begin(&Adafruit128x64, I2C_ADDRESS);
oled.setFont(System5x7);
oled.clear();
oled.println("record to SD-2");
oled.println();
Serial.print("Initializing SD card...");
if (!SD.begin(10)) {
Serial.println("initialization failed!");
oled.println("initialization failed!");
return;
}
oled.println("initialization done.");
Serial.println("Initialization done");
// so you have to close this one before opening another.
dataFile = SD.open("planeSD.txt", FILE_WRITE);
Serial.println("this is starting");
delay(1000);
}
void loop() {
dataFile.flush();
while (ss.available() > 0) {
char inChar = ss.read();
dataFile.print(inChar);
}
}
Sender Code:
/*
* Simple Dumpfile on Plane
2-28-16 jaf
Changed SD.h to TSD.h to agree with teensy library change
2-29-16 jaf
minor ajustments & change data-rate 3-1-16 jaf
*/
#include <TSD.h>
#include <SPI.h>
const int chipSelect = 10;
File dataFile;
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
Serial3.begin(9600);
Serial.print("Initializing SD card...");
// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
return;
}
Serial.println("card initialized.");
File dataFile = SD.open("altimu1.txt");
dataFile.flush();
// if the file is available, read it:
if (dataFile) {
while (dataFile.available()) {
char inbyte = dataFile.read();
Serial3.print(inbyte);
}
}
// if the file isn't open, pop up an error:
else {
Serial.println("error opening altimu1.txt");
}
}
void loop()
{
}
see anything bizarre in here?
john