thermalTest.frink

Download or view thermalTest.frink in plain text format


g = new graphics
win = g.show[]
readings = new array

for line = lines["file:///dev/ttyUSB0"]
{
   if length[line] != 15
      next

   temperature = parseInt[substrLen[line,11,4]] * 10^-parseInt[substrLen[line,6,1]]
   if substrLen[line,1,1] == "1"
      temperature = -temperature

   scale = substrLen[line, 4, 2]
//   println[scale]
   
   if scale == "10"
      temperature = C[temperature]
   else
      if scale == "20"
         temperature = F[temperature]

   readings.push[temperature]
   count = 0
   p = new polyline      
   for r = readings
   {
      p.addPoint[count, -r]
      count = count + 1
   }
      
   println[format[F[temperature],1,1]]
   g = new graphics
   g.add[p]
   win.replaceGraphics[g]
}


Download or view thermalTest.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 20218 days, 0 hours, 24 minutes ago.