mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-11 10:28:29 -04:00
updated formatting, baud
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1642 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
parent
17804fbc29
commit
6512531bf9
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Example of DataFlash library.
|
||||
Code by Jordi Muñoz and Jose Julio. DIYDrones.com
|
||||
Code by Jordi MuÒoz and Jose Julio. DIYDrones.com
|
||||
*/
|
||||
|
||||
#include <DataFlash.h>
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(57600);
|
||||
Serial.begin(38400);
|
||||
DataFlash.Init(); // DataFlash initialization
|
||||
|
||||
Serial.println("Dataflash Log Test 1.0");
|
||||
@ -31,8 +31,7 @@ void setup()
|
||||
// This is similar to what we will do...
|
||||
DataFlash.StartWrite(1);
|
||||
Serial.println("Writing to flash... wait...");
|
||||
for (int i=0;i<1000;i++) // Write 1000 packets...
|
||||
{
|
||||
for (int i = 0; i < 1000; i++){ // Write 1000 packets...
|
||||
// We write packets of binary data... (without worry about nothing more)
|
||||
DataFlash.WriteByte(HEAD_BYTE1);
|
||||
DataFlash.WriteByte(HEAD_BYTE2);
|
||||
@ -51,21 +50,22 @@ void setup()
|
||||
|
||||
void loop()
|
||||
{
|
||||
int i;
|
||||
byte tmp_byte1;
|
||||
byte tmp_byte2;
|
||||
int tmp_int;
|
||||
int i, tmp_int;
|
||||
byte tmp_byte1, tmp_byte2;
|
||||
long tmp_long;
|
||||
|
||||
Serial.println("Start reading page 1...");
|
||||
|
||||
DataFlash.StartRead(1); // We start reading from page 1
|
||||
for (i=0;i<200;i++) // Read 200 packets...
|
||||
{
|
||||
|
||||
for (i = 0; i < 200; i++){ // Read 200 packets...
|
||||
|
||||
tmp_byte1 = DataFlash.ReadByte();
|
||||
tmp_byte2 = DataFlash.ReadByte();
|
||||
|
||||
Serial.print("PACKET:");
|
||||
if ((tmp_byte1==HEAD_BYTE1)&&(tmp_byte1==HEAD_BYTE1))
|
||||
{
|
||||
|
||||
if ((tmp_byte1 == HEAD_BYTE1) && (tmp_byte1 == HEAD_BYTE1)){
|
||||
// Read 4 ints...
|
||||
tmp_int = DataFlash.ReadInt();
|
||||
Serial.print(tmp_int);
|
||||
@ -94,6 +94,5 @@ void loop()
|
||||
}
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
delay(10000);
|
||||
}
|
Loading…
Reference in New Issue
Block a user