Arduino Forum

Forum 2005-2010 (read only) => General => Exhibition => Topic started by: spycatcher2k on Apr 02, 2010, 09:21 pm

Title: Web Control - without Ethernet Shield
Post by: spycatcher2k on Apr 02, 2010, 09:21 pm
A Simple Script to show accessing the Arduino over the internet, needs a PC connected to the web (and port forwarding set on you router if you have one).
to Add - Supply feedback using scripts from vb to build TXT files (with data from board). Ive already achieved this, so just wanted to try web browser control.

Arduino file :

/*
 Rem_con_1
 
 Remote Control V1
 
 PC Control Arduino board
 Basic DIGITAL on/off for led 13

 The circuit:
 Nothing but USB lead (for serial Communication
 with Controller PC)
 
 Created : 18/03/10
 by : Drew Anderson
 
 Control program written in MS Visual Basic 6
 
 */

int inByte = 0;

void setup()
{
 // start Serial Port - Serial.println commands were for fault
 // finding, and feedback for command control.
 Serial.begin(9600);
 // Set pin 13 (onboard LED) to output
 pinMode(13, OUTPUT);
 // Serial.println("Program Started");
 /*
 Make sure the LED is turned off to start with
 and send handshake to control program to flag LOW status
 ** Handshake added 19/03/10 **
 */
 
 
 Serial.print("X");
 digitalWrite(13,LOW);
}

void loop()
{
 if (Serial.available() >0)
 {
   inByte = Serial.read();
   Serial.println(inByte);
   if (inByte == '1')
   {
     digitalWrite(13, HIGH);
    // Serial.println("LED is now ON");
   }
   if (inByte == '0')
   {
     digitalWrite(13, LOW);
    // Serial.println("LED is now OFF");
   }
 }
 }
 
###########################################
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # #

Download Here :

h t t p s ://
kwmo02.
kryptiva.
com/
teambox/i/492/da7bgrx80wfry9sfoyb4kmom6
Title: Re: Web Control - without Ethernet Shield
Post by: spycatcher2k on Apr 04, 2010, 07:53 pm
Well what do you know - I uploaded the wrong file set ! ! ! ! !
Sorry Guys 'n' Girls.
If you want my code then e-mail me :
arduino@badnetwork.co.uk
or download here :
https://kwmo02.kryptiva.com/teambox/i/492/da7bgrx80wfry9sfoyb4kmom6

Sorry again

Spycatcher
Title: Re: Web Control - without Ethernet Shield
Post by: jumpjack on Oct 26, 2010, 10:51 pm
How do you control the VB program from internet?!?
Title: Re: Web Control - without Ethernet Shield
Post by: spycatcher2k on Oct 27, 2010, 12:42 pm
Hi jumpjack,
The VB program is a custom written web server, with triggers that send strings to the com port. e.g http://no-ip address/control/pin13on.ctrl - the VB program parses the line and if the last part = /pin13on.ctrl then it would send "1" to com port. (you can ofcourse replace pin13on.ctrl with any string e.g 1.htm or spam.lovely etc. - check in the forums for php based control aswell, never tried it yet, but looks quite easy.

Cheers

PS - leave me a pvt message with your email and i'll send you the VB code.
Title: Re: Web Control - without Ethernet Shield
Post by: jumpjack on Oct 27, 2010, 01:17 pm
thanks, I downloaded your code... which I can't use, as I do not have VB, just VB.NET...  :-[
Title: Re: Web Control - without Ethernet Shield
Post by: spycatcher2k on Oct 27, 2010, 02:20 pm
I just GOOGLED VB .NET web server, and got loads of hits, it should be easy enough to modify one of the given examples to send strings to the com port.

Cheers again. ;)
Title: Re: Web Control - without Ethernet Shield
Post by: jumpjack on Oct 27, 2010, 03:09 pm
I think web connection is the hardest part of your VB project, actually.
Title: Re: Web Control - without Ethernet Shield
Post by: spycatcher2k on Oct 28, 2010, 01:55 pm
sorry peeps,
I don't have .NET, i'm happy with VB6 at the moment. It does everything I want it to, maybe in the future!

Having looked at the .NET code on the net, it looks quite easy to modify existing code to match the trigger string (e.g led13on.htm or led13off.htm), then send a Chr to the COM: port.
Title: Re: Web Control - without Ethernet Shield
Post by: jumpjack on Oct 28, 2010, 07:19 pm
Can you provide a link?

Do you think your VB code can be ported to Visual Basic For Applications=? I found several examples about using VBA for socket programming, but none is working.
For example,
Set Sock = New MSWinsockLib.winsock
raises an error as ActiveX can't create the object.

A very small VBA macro just using msgbox to show "Hello world" upon receiving something on port 80 would be enough for me to have something to start from.  :-/