Go Down

Topic: Web Control - without Ethernet Shield (Read 4721 times) previous topic - next topic

spycatcher2k

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
Mrs Drew
-=-
http://www.uk-pcb.co.uk - UK PCB Fab Company
I will design & code for you, but I will also charge you (PM me)
If you don't like my answers, realize : I'm not being cheeky, I'm Just trying to prompt you to use your own brain/google etc.

spycatcher2k

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
Mrs Drew
-=-
http://www.uk-pcb.co.uk - UK PCB Fab Company
I will design & code for you, but I will also charge you (PM me)
If you don't like my answers, realize : I'm not being cheeky, I'm Just trying to prompt you to use your own brain/google etc.

jumpjack

How do you control the VB program from internet?!?

spycatcher2k

#3
Oct 27, 2010, 12:42 pm Last Edit: Oct 27, 2010, 12:45 pm by spycatcher2k Reason: 1
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.
Mrs Drew
-=-
http://www.uk-pcb.co.uk - UK PCB Fab Company
I will design & code for you, but I will also charge you (PM me)
If you don't like my answers, realize : I'm not being cheeky, I'm Just trying to prompt you to use your own brain/google etc.

jumpjack

#4
Oct 27, 2010, 01:17 pm Last Edit: Oct 27, 2010, 01:28 pm by jumpjack Reason: 1
thanks, I downloaded your code... which I can't use, as I do not have VB, just VB.NET...  :-[

spycatcher2k

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. ;)
Mrs Drew
-=-
http://www.uk-pcb.co.uk - UK PCB Fab Company
I will design & code for you, but I will also charge you (PM me)
If you don't like my answers, realize : I'm not being cheeky, I'm Just trying to prompt you to use your own brain/google etc.

jumpjack

I think web connection is the hardest part of your VB project, actually.

spycatcher2k

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.
Mrs Drew
-=-
http://www.uk-pcb.co.uk - UK PCB Fab Company
I will design & code for you, but I will also charge you (PM me)
If you don't like my answers, realize : I'm not being cheeky, I'm Just trying to prompt you to use your own brain/google etc.

jumpjack

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.  :-/

Go Up