Sub Process_Globals
Public Serial1 As Serial
Private timer1 As Timer
Private sd As SD
Private i As Int
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
sd.Initialize(4) '4 is the CS pin when using the ethernet shield
timer1.Initialize("timer1_Tick", 1000)
timer1.Enabled = True
End Sub
Sub Timer1_Tick
Dim a As String
Dim bc As ByteConverter
Dim k(1) As Byte
sd.OpenReadWrite("DATALOG.TXT")
i=Rnd(0,1023)
a=i
k=bc.stringToBytes(a)
sd.Stream.WriteBytes(k,0,k.length)
sd.Close
Log(i)
End Sub