I would like to use the Logger class to write everyting to a CSV or TXT file on the NXT. I would like to log 7 integers per line. The caching mode seems perfect. If I understand correctly it will keep as much as possible in memory and clear the oldest when running out of space. Perfect ! When finnished I still need to write the cache to a file, so I think I need to stopLogging first and then use sendCache, but it seems that sendCache has 2 paremeters. A DataOutputStream and a DataInputStream. Why an inputstream ???
Does someone have an example that does something like this ? I browsed the internet and found examples to send the data via BT to the PC, but not one where it writes the cache to a logfile.
Here is a code snippet of what I was thinking :
- Code: Select all
Logger xxLog = new NXTDataLogger () ;
xxLog.startCachingLog () ;
xxLog.setColumns (new LogColumn[] {
new LogColumn ("C1", LogColumn.DT_INTEGER, false) ;
new LogColumn ("C2", LogColumn.DT_INTEGER, false) ;
new LogColumn ("C3", LogColumn.DT_INTEGER, false) ;
...
new LogColumn ("C7", LogColumn.DT_INTEGER, false) ;
});
// Start reading, displaying and logging data
while (! Button.ESCAPE.isDown ()) {
[ some code .....]
// write to Logger
xxLog.writeLog (i1) ; xxLog.writeLog (i2) ; ... ; xxLog.writeLog (i7) ;
xxLog.finishLine() ;
Delay.msDelay(250) ;
}
xxLog.stopLogging() ;
xxLog.sendCache ( NOT SURE WHAT GOES HERE ) ;
Your help is appreciated !
Kind regards,
BlueHaze
