Permalink
Browse files

Updated the CommandTest code to Arudino v1.0. I had to change the Ser…

…ial.print(char(26)) to Serial.write(26). Also added more comments to top of code. File is now .ino.
  • Loading branch information...
1 parent 13b502b commit 7fad14e3535e61eea2878fc533b36e5e486ea865 @nseidle nseidle committed Feb 22, 2012
Showing with 25 additions and 8 deletions.
  1. +25 −8 OpenLog_CommandTest/{OpenLog_CommandTest.pde → OpenLog_CommandTest.ino}
@@ -5,9 +5,21 @@
Controlling OpenLog command line from an Arduino
- This example code assumes the OpenLog is set to operate in NewLog mode, meaning OpenLog should power
- up and output '12<'. This code then sends the three escape characters and then sends the commands
- to create a new random file called nate###.txt where ### is a random number from 0 to 999.
+ Connect the following OpenLog to Arduino:
+ TXO of OpenLog to RX of the Arduino
+ RXI to TX
+ GRN to 2
+ VCC to 5V
+ GND to GND
+
+ NOTE: When uploading this example code you must temporarily disconnect TX and RX while uploading
+ the new code to the Arduino. Otherwise you will get a "avrdude: stk500_getsync(): not in sync" error.
+
+ This example code assumes the OpenLog is set to operate at 9600bps in NewLog mode, meaning OpenLog
+ should power up and output '12<'. This code then sends the three escape characters and then sends
+ the commands to create a new random file called nate###.txt where ### is a random number from 0 to 999.
+
+ This code assume OpenLog is in the default state of 9600bps with ASCII-26 as the esacape character.
Be careful when sending commands to OpenLog. println() sends extra newline characters that
cause problems with the command parser. The new v2.51 ignores \n commands so it should be easier to
@@ -26,7 +38,7 @@ void setup() {
pinMode(resetOpenLog, OUTPUT);
randomSeed(analogRead(0));
- Serial.begin(115200);
+ Serial.begin(9600);
//Reset OpenLog
digitalWrite(resetOpenLog, LOW);
@@ -40,9 +52,15 @@ void setup() {
}
//Send three control z to enter OpenLog command mode
- Serial.print(byte(26));
- Serial.print(byte(26));
- Serial.print(byte(26));
+ //This is how Arduino v0022 used to do it. Doesn't work with v1.0
+ //Serial.print(byte(26));
+ //Serial.print(byte(26));
+ //Serial.print(byte(26));
+
+ //Works with Arduino v1.0
+ Serial.write(26);
+ Serial.write(26);
+ Serial.write(26);
//Wait for OpenLog to respond with '>' to indicate we are in command mode
while(1) {
@@ -61,7 +79,6 @@ void setup() {
//New way
//sprintf(buff, "new nate%03d.txt", fileNumber);
//Serial.println(buff); //regular println works with v2.51 and above
-
//Wait for OpenLog to return to waiting for a command
while(1) {

0 comments on commit 7fad14e

Please sign in to comment.