Data Logging Arduino No Sd Card

I will show you how to do data logging using the Forth programming language (SwiftForth) and the Arduino.

We will not be using any SD cards. Just plug in the Arduino and pull up your Excel spreadsheet. The code will insert the data for us in each cell using the DDE client (Dynamic Data Exchange).

Full source code below:

\ upload sketch to arduino
\ modify terminal.f
\ modify sio.f
\ load terminal.f
\ load ddeclient in win32options

SERVER EXCEL
TOPIC c:\users\your path here\test1.xlsx

: r1 0 <# #S [CHAR] R HOLD #> ; \ r1c1, r2c1, r3c1…
: c1 0 <# #S [CHAR] C HOLD #> ;

FUNCTION: PurgeComm ( a b – x )
\ comhandle 8 PurgeComm

COM7 N,8,1 9600 BAUD

create serialbuf 256 allot
serialbuf 256 erase

: purge comhandle 8 PurgeComm ;
: sample purge 100 0 do (com-key) serialbuf i + c! loop ;

: colon [char] : ;
: skip2bytes 1 /string ; \ skip first 1 byte we dont need them
: excludenl 2dup 13 scan nip - ; \ exclude \n newline at the end of string
: extracttemp skip2bytes excludenl ;

: getdata serialbuf 100 colon scan extracttemp ;

: toexcel
z" s\ " zcount pad swap move
[char] " pad 2+ !
BL pad 3 + !
getdata pad zappend
z" \n" " zcount pad zcount + zappend
z" TELL " zcount pad zappend ;

: excelkey 1 begin sample drop 100 ms pad 50 erase
toexcel dup
r1 pad zappend
pad zcount evaluate 1+ key? until ; \ s" 823" TELL R1C1 <– r2c1 r3c1,