Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] [Help] Building a web page

Status
Not open for further replies.

sk8ter87

Member level 3
Joined
Dec 1, 2009
Messages
55
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
Malaysia
Activity points
1,665
Hi all edaboard forumer..
Hope you guyz can help me..

currently i'm working on web page where user interacts by pressing keys on keyboard.
The picture is attached below:

90_1291392510.jpg


So basically, i need to create button like in picture in web page..
Let say if the user pressed 'w' so it will work with forward button..
And the same thig for other button..

I really dunno how to do this.. and I'm also newbie in this thing..

Hope you guyz can help me..
 

Are you saying these buttons are on the screen to be clicked with a mouse or are they on the keyboard? If it's the keyboard, how does the user know which key for each action?

If the image is to be clickable, add an "on mouse down" event to the button image to trigger the action you require.

Brian.
 

Are you saying these buttons are on the screen to be clicked with a mouse or are they on the keyboard? If it's the keyboard, how does the user know which key for each action?

If the image is to be clickable, add an "on mouse down" event to the button image to trigger the action you require.

Brian.

Hi Brian..

For the keyboard.i will list down which key will respond to which button.. if click using mouse also can..but prefer to do using keyboard..
i tried to google about this..but could not find that help me most.
can you explain bit more or may you have any example on this..

Thanks..
 

It is actually more difficult to use keys than screen buttons. I have set up a small demonstration for you at sk8ter87 Demo but I will have to remove it from the Internet in a few days time. Use the "view page source" or equivalent in your browser to see how it is done. You can either use Javascript or you own code where I have used the alert() function.

If you want to use the keyboard, as far as I know, the only way is to ensure the cursor is in inside a form box then either add a "submit" button or press the Enter key. Web pages are by their nature designed to interact visually rather than read the keyboard directly although you can write your own special function of course.

Brian.
 

Also you can add a textbox object, and monitor key presses generating on key down events or text change.

you could also :
**broken link removed**
 

It is actually more difficult to use keys than screen buttons. I have set up a small demonstration for you at sk8ter87 Demo but I will have to remove it from the Internet in a few days time. Use the "view page source" or equivalent in your browser to see how it is done. You can either use Javascript or you own code where I have used the alert() function.

If you want to use the keyboard, as far as I know, the only way is to ensure the cursor is in inside a form box then either add a "submit" button or press the Enter key. Web pages are by their nature designed to interact visually rather than read the keyboard directly although you can write your own special function of course.

Brian.

Hi Brian..
Thanks for the demo bro..the purpose i want to create this website is to control the hardware straight from the web browser..so bro..if i planned to like what you did,is it possible for me assign a key to it.. like if i click the up button,can i set like equal to character 'w'.This character that will be transfer some function then can operate the hardware..
Thanks..

Also you can add a textbox object, and monitor key presses generating on key down events or text change.

you could also :
**broken link removed**

Thanks ama_trig.. I will look on it..by any chance you know to control hardware from web browser??
 

Yes, you can assign a character like 'w' or any other value. Where I used the Javascript 'alert()' function you can place any code of your own to perform whatever action you like. You could for example send 'w' through the serial or USB port. To learn how to do that I suggest you look for a tutorial, it is a bit complicated to explain on the forum.

If you want to copy the code I used, don't wait too long as the web site has to change soon and I will need to remove the demonstration code.

Brian.
 

Hi Brian..

Thanks for the demo code again..I already copy the code.. I tried to do as what you say in the previous reply,but still can't get the result.. :(
Can you show me how to do it for one button,may be from there i can get much more clear picture how to do it..

You could for example send 'w' through the serial or USB port.

For this part,after i done some research for this part in internet..i'm still blur on this.
Still don't get how this happen.. Ex:after assign the character to each button,how the character is sent through from website to serial or usb port..
Sorry Brian for giving you trouble.. I totally new to this thing..
Hope you can help man..
 

Thanks ama_trig.. I will look on it..by any chance you know to control hardware from web browser??
your welcome.
sorry for delay, I wasn't checking on this post, if you mean via web browser, yes, kind of, wasn't directly the hardware, it was connected to another pc, actually, what I did was simple.
I hosted an application on other pc, a simple web server, then hosted a simple web page containing two buttons, each redirecting a page to something like **broken link removed** which was hosted on that local server, and when pressed, it was sending this url to the web server, then I captured web server request tag and if it is ButtonPressed1 or ButtonPressed2, I responded to hardware.
something like php's get method, except it was much more simple.
 
Last edited by a moderator:

OK, Lets assume you know your way through php and have a decent php server running on pc1, and your application which runs the hardware is also on pc1, What you can do here is (if you may use php):

1)Create a tcp/ip socket and Listen to a specific port on local TCP/IP like, by the main application which you have written to control the hardware, like 127.0.0.1:12345 on pc1

2)Bind a socket on that php code to that local server you were just listening.
(by this step you have a direct connection between a php code and your application)
Socket Programming With PHP
3)Bingo: Transfer the data

Lets assume above method doesn't work out.
What you can do is, create a tcp/ip socket with some known port on main application which runs the hardware on pc1 , and listen for a new connection - IP bind.
have the server running your web on that pc1.
so what you will be having on pc1 so far
1)a webserver holding you web contents listening on port 80
2)a hardware controller, with a tcp/ip socket listening to some port
Have a URL redirection to ( http://Pc1Ip:ThatSomePortYouWereListeningTo/TurnLeft) by pressing the button
You can easily read TurnLeft by the socket you have created as a request tag by the browser.
 
Last edited by a moderator:

Lets assume above method doesn't work out.
What you can do is, create a tcp/ip socket with some known port on main application which runs the hardware on pc1 , and listen for a new connection - IP bind.
have the server running your web on that pc1.
so what you will be having on pc1 so far
1)a webserver holding you web contents listening on port 80
2)a hardware controller, with a tcp/ip socket listening to some port
Have a URL redirection to ( https://Pc1Ip:ThatSomePortYouWereListeningTo/TurnLeft) by pressing the button
You can easily read TurnLeft by the socket you have created as a request tag by the browser.

Hi ama_trig..
Thanks for the help..i'm planning to do the 2nd method that you mention above..
my project flow will be like this
website - vb - hardware..
so when user enter the press any key in webpage..it will respond to vb automatically using mysql database..and from that it control the hardware ..
my problem is now, in the vb..i dont know how to pass data from mysql to the MSComm.. Do you how this can be done?
Hope you can help on this..

Thanks
 
Last edited by a moderator:

so if I understood correctly you are using mysql as a bridge between WEB and VB? Why not using winsock ?

yup..i'm using mysql.. i found in the internet say that it can be done using mysql..that is why i tried using mysql..
about the winscok,i'm not so sure about that.. :(
 

Hi ama_trig..

I done the part where the website can interact with the vb and then control the car..
I planning to show the demo using LAN..
I though it can be done using apache..i tried using it but didn't manage
can you help me on this.. ?
 

OK
lets see, if you are serving your code in php,
1)
Download Quickphp quickphp - Google Search
Set your root and index html place.
Bind it on loopback 0.0.0.0 or localhost 127.0.0.1 or pc's host local ip for example, 192.168.1.X and port 80, start the service and unblock it, if you want to test over lan.
Take into account that doing so for WAN will require portforward
[I don't know if quickphp supports MYSQL or not]

2)Download UniServer
uniserver - Google Search
unpack it
Put your html files in C:\UniServer\www\
precheck and start the service by executing the main C:\UniServer\Start.exe
right click on icon and press: Install and run all services.
 

OK
lets see, if you are serving your code in php,
1)
Download Quickphp quickphp - Google Search
Set your root and index html place.
Bind it on loopback 0.0.0.0 or localhost 127.0.0.1 or pc's host local ip for example, 192.168.1.X and port 80, start the service and unblock it, if you want to test over lan.
Take into account that doing so for WAN will require portforward
[I don't know if quickphp supports MYSQL or not]

2)Download UniServer
uniserver - Google Search
unpack it
Put your html files in C:\UniServer\www\
precheck and start the service by executing the main C:\UniServer\Start.exe
right click on icon and press: Install and run all services.

Hi ama_trig..

Thanks for your help.. I will try it first and inform you..
Let say,i'm using one of two method that you mention above..
do i still need to use the apache ??

Thanks again..
 

ama_trig..

In the vb that i created,do i need to add anything like listen to port 80..
or add anything else?
 

I done the part where the website can interact with the vb and then control the car..

Basically, I did understand that your interfacing between WEB-VB-Hardware is done.

In the vb that i created,do i need to add anything like listen to port 80..

What uniserver does is act as server, the rest is done by your VB application and web site you have created.
so if I did understand correctly, you are running a webserver(uniserver) hosting a website which connects to sql file, then you write the changes to it.
also a visual basic application is running on that pc, checking sql file for changes and act on change to control the hardware.
according to above, no you don't need to do anything else over vb.

Maybe you could upload your project scheme so I can understand better on what your trying to accomplish.
 

so if I did understand correctly, you are running a webserver(uniserver) hosting a website which connects to sql file, then you write the changes to it.
also a visual basic application is running on that pc, checking sql file for changes and act on change to control the hardware.

Yup..it works like you mention above..i tried to use uniserver but there is some problem..when the key is pressed..nothing is happen..
so i thought want to used XAMPP.. in there it's working fine only part where user from other pc press key..it does not control the hardware..

Hope you can help me..
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top