Created
October 25, 2017 14:34
-
-
Save youkidearitai/736b5d1547b88852b88bcc84400017b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// #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