Ocean mirroring project - Gobetwino

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)
.

Below is code that gets ocean data directly from a NOAA data site (requires the 5100 Ethernet shield).

//zoomkat 12-22-10
//simple ethernet client test code
//for use with IDE 0021 and W5100 ethernet shield
//modify the arduino lan ip address as needed
//open serial monitor to see what the arduino receives
//push the shield reset button to run client again

#include <SPI.h>
#include <Ethernet.h>
String readString, readString1;
int x=0;
char lf=10;

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
//byte ip[] = { 192, 168, 1, 102 };
//byte server[] = { 140, 90, 238, 27 }; // NOAA
char serverName[] = "www.ndbc.noaa.gov";

EthernetClient client;

void setup()
{
  Ethernet.begin(mac);
  Serial.begin(9600);
  Serial.println("starting simple arduino client test");
  Serial.println();
  Serial.println("connecting...");

  if (client.connect(serverName, 80)) {
    Serial.println("connected");
    client.println("GET /data/5day2/44013_5day.txt HTTP/1.1");
    client.println("Host: www.ndbc.noaa.gov");
    client.println("Connection: close"); 
    client.println();
  } else {
    Serial.println("connection failed");
  }
}

void loop()
{
  if (client.available()) {
    char c = client.read();
    //Serial.print(c);  // uncomment to see raw feed
    if (c==lf) x=(x+1);
    if (x==14) readString += c;
    //readString += c;
  }

  if (!client.connected()) {
     client.stop();

    Serial.println("Current data row:" );
    Serial.print(readString);
    Serial.println();
    readString1 = (readString.substring(41,43));
    Serial.println();
    Serial.print("DPD sec: ");
    Serial.println(readString1);
    Serial.println("done");

    for(;;);

    }
 }

Thanks zoomkat, however we are already committed to he Gobetwino route, although we did look at ethernet in the beginning.

We have invested a considerable amount of time learning and testing Gobetwino, and we would appreciate it if someone could help us in using the RFLIN command to create a variable int value.

Thanks!