Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
// #include <SoftwareSerial.h>
#include <SD.h>
#include <SPI.h>
#define CAMERA_RX 3
#define CAMERA_TX 2
#define BAUD_RATE 115200
#define chipSelect 4
File logFile;
void setup() {
pinMode(8, INPUT_PULLUP);
if(chipSelect != 10) pinMode(10, OUTPUT); // SS on Uno, etc.
// put your setup code here, to run once:
Serial.begin(BAUD_RATE);
Serial1.begin(BAUD_RATE);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
SD.begin(chipSelect);
logFile = SD.open("TEST.TXT", FILE_WRITE);
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(8) == LOW) {
logFile.close();
}
if (Serial1.available()) {
Serial.write(Serial1.read());
}
if (Serial.available()) {
byte r = Serial.read();
Serial1.write(r);
logFile.write(r);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment