Permalink
Browse files

Updated example sketches to Arduino v1.0. This required only some sma…

…ll changes (Serial.print to Serial.write).
  • Loading branch information...
nseidle committed Feb 22, 2012
1 parent 7fad14e commit 8326eedbf6f7072adf81e2d4cbcd2bf59ab25237
@@ -0,0 +1 @@
+This example code shows how to control the OpenLog command line from an Arduino. This 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.
@@ -38,9 +38,9 @@ void setup()
{
pinMode(ledPin, OUTPUT);
- //Serial.begin(9600); //9600bps is default for OpenLog
+ Serial.begin(9600); //9600bps is default for OpenLog
//Serial.begin(57600); //Much faster serial, used for testing buffer overruns on OpenLog
- Serial.begin(115200); //Much faster serial, used for testing buffer overruns on OpenLog
+ //Serial.begin(115200); //Much faster serial, used for testing buffer overruns on OpenLog
delay(1000); //Wait a second for OpenLog to init
@@ -50,7 +50,7 @@ void setup()
void loop()
{
- int testAmt = 10;
+ int testAmt = 4;
//At 9600, testAmt of 4 takes about 1 minute, 10 takes about 3 minutes
//At 57600, testAmt of 10 takes about 1 minute, 40 takes about 5 minutes
//testAmt of 10 will push 111,000 characters/bytes. With header and footer strings, total is 111,052
@@ -62,7 +62,7 @@ void loop()
for(int k = 33; k < 43 ; k++)
{
//Print one line of 110 characters with marker in the front (markers go from '!' to '*')
- Serial.print(k, BYTE); //Print the ASCII value directly: ! then " then #, etc
+ Serial.write(k); //Print the ASCII value directly: ! then " then #, etc
Serial.println(":abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-!#");
//delay(50);
@@ -93,8 +93,8 @@ void loop()
while(1)
{
digitalWrite(ledPin, HIGH); // set the LED on
- delay(1000); // wait for a second
+ delay(100); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
- delay(1000); // wait for a second
+ delay(100); // wait for a second
}
}

0 comments on commit 8326eed

Please sign in to comment.