-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nathan Seidle
committed
Feb 9, 2018
1 parent
e4bdee0
commit 55df7ec
Showing
15 changed files
with
441 additions
and
330 deletions.
There are no files selected for viewing
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
59 changes: 59 additions & 0 deletions
59
firmware/Arduino_Examples/Example1_SoftwareLogging/Example1_SoftwareLogging.ino
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
Recording to OpenLog example | ||
By: Nathan Seidle | ||
SparkFun Electronics | ||
Date: February 8th, 2018 | ||
License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license). | ||
This is an example of basic recording to OpenLog using software serial. This example is best for users who | ||
want to use OpenLog with an Uno or other platform capable of softwareSerial. | ||
Connect the following OpenLog to Arduino: | ||
RXI of OpenLog to pin 5 on Arduino | ||
VCC to 5V | ||
GND to GND | ||
This example records whatever the user OpenLog.prints(). This uses software serial on pin 5 instead | ||
of hardware serial (TX/RX pins). Nearly any pin can be used for software serial. | ||
*/ | ||
|
||
#include <SoftwareSerial.h> | ||
|
||
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||
//Connect RXI of OpenLog to pin 5 on Arduino | ||
SoftwareSerial OpenLog(0, 5); // 0 = Soft RX pin (not used), 5 = Soft TX pin | ||
//5 can be changed to any pin. See limitation section on https://www.arduino.cc/en/Reference/SoftwareSerial | ||
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||
|
||
int statLED = 13; | ||
|
||
float dummyVoltage = 3.50; //This just shows to to write variables to OpenLog | ||
|
||
void setup() { | ||
pinMode(statLED, OUTPUT); | ||
Serial.begin(9600); | ||
|
||
OpenLog.begin(9600); //Open software serial port at 9600bps | ||
|
||
Serial.println("This serial prints to the COM port"); | ||
OpenLog.println("This serial records to the OpenLog text file"); | ||
|
||
//Write something to OpenLog | ||
OpenLog.println("Hi there! How are you today?"); | ||
OpenLog.print("Voltage: "); | ||
OpenLog.println(dummyVoltage); | ||
dummyVoltage++; | ||
OpenLog.print("Voltage: "); | ||
OpenLog.println(dummyVoltage); | ||
|
||
Serial.println("Text written to file. Go look!"); | ||
} | ||
|
||
void loop() { | ||
digitalWrite(statLED, HIGH); | ||
delay(1000); | ||
digitalWrite(statLED, LOW); | ||
delay(1000); | ||
} | ||
|
||
|
53 changes: 53 additions & 0 deletions
53
firmware/Arduino_Examples/Example2_HardwareLogging/Example2_HardwareLogging.ino
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
Recording to OpenLog example | ||
By: Nathan Seidle | ||
SparkFun Electronics | ||
Date: February 8th, 2018 | ||
License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license). | ||
This is an example of basic recording to OpenLog using hardware serial. This example is best for users who | ||
are plugging the OpenLog directly onto the programming connector on an Arduino Pro Mini or Arduino Pro. | ||
We DON'T recommend this method for beginners. See Example 1 for an easier software serial example. | ||
The reason is if you upload a sketch to an Arduino with OpenLog attached then OpenLog will log the | ||
uploading of your sketch. This may cause the OpenLog to become reconfigured. No harm will be | ||
caused but it can corrupt the log file. | ||
Connect the following OpenLog to Arduino: | ||
RXI of OpenLog to TX on Arduino | ||
VCC to 5V | ||
GND to GND | ||
This example records whatever the user Serial.prints(). This is the easiest but NOTE: You cannot | ||
upload sketches to your Arduino with the OpenLog attached (because of bus contention). Upload this | ||
sketch first, and then connect the OpenLog to the TX pin on the Arduino. | ||
*/ | ||
|
||
int statLED = 13; | ||
|
||
float dummyVoltage = 3.50; //This just shows to to write variables to OpenLog | ||
|
||
void setup() { | ||
pinMode(statLED, OUTPUT); | ||
Serial.begin(9600); | ||
|
||
Serial.println("Example print to OpenLog"); | ||
|
||
Serial.println("Anything printed to COM port gets logged!"); | ||
|
||
//Write something to OpenLog | ||
Serial.println("Hi there! How are you today?"); | ||
Serial.print("Voltage: "); | ||
Serial.println(dummyVoltage); | ||
dummyVoltage++; | ||
Serial.print("Voltage: "); | ||
Serial.println(dummyVoltage); | ||
} | ||
|
||
void loop() { | ||
digitalWrite(statLED, HIGH); | ||
delay(1000); | ||
digitalWrite(statLED, LOW); | ||
delay(1000); | ||
} | ||
|
4 changes: 2 additions & 2 deletions
4
...enLog_ReadExample/OpenLog_ReadExample.ino → ...s/Example3_ReadFile/Example3_ReadFile.ino
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
2 changes: 1 addition & 1 deletion
2
...rgeFile/OpenLog_ReadExample_LargeFile.ino → ..._ReadLargeFile/Example4_ReadLargeFile.ino
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
Oops, something went wrong.