Hi there,
I and my team are working on a project that utilizes Arduino and Gobetwino. Our goal is to create an apparatus that can control an aquarium heater to match the sea temperature in a tropical region.
The Arduino should tell the computer to start a web browser, go to a webpage, and save the temp as a text file. This is accomplished by an SPWEX command. Then, the Arduino needs to ask for the text file line #1, and get that back from the computer (RFLIN.)
We currently have code that starts internet explorer and saves the temp, as well as code to control the heater with a minimum temp on which to start and stop the heater from functioning (achieved by a relay.) Our final and main current objective is to use an RFLIN command to ask for the text file line and return it to arduino.
Our problem is that we are not sure how to use the returned value as our integer value in the arduino code. This variable changes of course, and we need the returned value to be the integer value. Also, we are still learning how to use gobetwino effectively, so we would appreciate it if someone could explain how to activate gobetwino commands from an arduino sketch, considering we have multiple commands for SPWEX and RFLIN.
Any help would be greatly appreciated!
Our gobetwino output code for saving the temperature:
Function Get_HTML_Temp_String()
Dim Browser,strOut
Set Browser = CreateObject("InternetExplorer.Application")
With Browser
.Visible = False
.Navigate "Nassau Water Temperature | Bahamas"
'Wait for Browser
Do While .Busy
WScript.Sleep 100
Loop
End With
Set tempelement = Browser.Document.getElementById("sea-temperature")
strOut = tempelement.innerText
Browser.Quit
Browser = Null
Get_HTML_Temp_String = strOut
end function
Sub Write_Temp_To_File(tempString)
outFile="c:\test\temp.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(outFile,True)
objFile.Write tempString
objFile.Close
End Sub
Function Parse_Temp_String(tempString)
dim cString, fString, cPos, fPos
cPos=InStr(tempString,"C")
cString=left(tempString,cPos-2)
fPos=InStr(tempString,"F")
fString=Mid(tempString,cPos+3,(fPos-1)-(cPos+3))
Parse_Temp_String=cString & vbCrLf & fString
End Function
dim temp
temp=Get_HTML_Temp_String
temp=Parse_Temp_String(temp)
Msgbox temp
Write_Temp_To_File(temp)
.