Crbasic example 32. html – Campbell Scientific CR1000 Measurement and Control System User Manual

Page 170

Advertising
background image

Section 7. Installation

170 

 

 

CRBasic Example 32. HTML 

'NOTE: Lines ending with "+" are wrapped to the next line to fit on the printed page

'NOTE Continued: Do not wrap lines when entering program into CRBasic Editor.

Dim

Commands

As String

* 200

Public

Time(9), RefTemp,

Public

Minutes

As String

, Seconds

As String

, Temperature

As String

DataTable

(CRTemp,True,-1)

DataInterval

(0,1,Min,10)

Sample

(1,RefTemp,FP2)

Average

(1,RefTemp,FP2,False)

EndTable

'Default HTML Page

WebPageBegin

("default.html",Commands)

HTTPOut

("<html>")

HTTPOut

("<style>body {background-color: oldlace}</style>")

HTTPOut

("<body><title>Campbell Scientific CR1000 Datalogger</title>")

HTTPOut

("<h2>Welcome To the Campbell Scientific CR1000 Web Site!</h2>")

HTTPOut

("<tr><td style=" + CHR(34) +"width: 290px" + CHR(34) + ">")

HTTPOut

("<a href=" + CHR(34) + "http://www.campbellsci.com" + _

CHR(34) + ">")

HTTPOut

("<img src="+

CHR

(34) +"/CPU/SHIELDWEB2.jpg"+

CHR

(34) + "width=" + _

CHR

(34) +"128"+

CHR

(34)+"height="+

CHR

(34)+"155"+

CHR

(34) + "class=" + _

CHR

(34) +"style1"+

CHR

(34) +"/></a></td>")

HTTPOut

("<p><h2> Current Data:</h2></p>")

HTTPOut

("<p>Time: " + time(4) + ":" + minutes + ":" + seconds + "</p>")

HTTPOut

("<p>Temperature: " + Temperature + "</p>")

HTTPOut

("<p><h2> Links:</h2></p>")

HTTPOut

("<p><a href="+

CHR

(34) +"monitor.html"+

CHR

(34)+">Monitor</a></p>")

HTTPOut

("</body>")

HTTPOut

("</html>")

WebPageEnd

'Monitor Web Page

WebPageBegin

("monitor.html",Commands)

HTTPOut

("<html>")

HTTPOut

("<style>body {background-color: oldlace}</style>")

HTTPOut

("<body>")

HTTPOut

("<title>Monitor CR1000 Datalogger Tables</title>")

HTTPOut

("<p><h2>CR1000 Data Table Links</h2></p>")

HTTPOut

("<p><a href="+

CHR

(34) + "command=TableDisplay&table=CRTemp&records=10" + _

CHR

(34)+">Display Last 10 Records from DataTable CR1Temp</a></p>")

HTTPOut

("<p><a href="+

CHR

(34) + "command=NewestRecord&table=CRTemp"+

CHR

(34) + _

">Current Record from CRTemp Table</a></p>")

HTTPOut

("<p><a href="+

CHR

(34) + "command=NewestRecord&table=Public"+

CHR

(34) + _

">Current Record from Public Table</a></p>")

HTTPOut

("<p><a href="+

CHR

(34) + "command=NewestRecord&table=Status" +

CHR

(34) + _

">Current Record from Status Table</a></p>")

HTTPOut

("<br><p><a href="+

CHR

(34) +"default.html"+

CHR

(34) + ">Back to the Home Page _

</a></p>")

HTTPOut

("</body>")

HTTPOut

("</html>")

WebPageEnd

Advertising