make website respond to button press

Hi all! I'm new to networking so bear with me. I want to be able to instantly control a public website through some sensor input on an arduino. Let say I want the color of the background to change when i push a physical button.

So far I have been able to use arduino + firmata + P5.js + P5.bots + node.js to make a website that responds instantly to a button press. See video here: Dropbox - boom.mp4 - Simplify your life

This works fine on localhost, but i want this to work on a public website.

What approach would you take? At this moment I assume that the arduino is connected to a PC with internet connection, but other suggestions without pc are welcome.

What approach would you take? At this moment I assume that the arduino is connected to a PC with internet connection, but other suggestions without pc are welcome.

If you want to use the PC for the Internet connection you must install some software there that does the forwarding of the data to your actual webserver.

If you want your Arduino to act autonomously you have to add some hardware to it (Ethernet Shield, WiFi hardware, etc.). The version you choose depends largely on what exactly you're planning to do. If that's just a hobby project where you want to show that you can have some local action visualized on the web you may choose the first version (PC as data forwarder). If that project should go a bit further (p.e. using the Arduino for weather sensors to be shown on the web) you probably better choose the second option.

"This works fine on localhost, but i want this to work on a public website. What approach would you take? At this moment I assume that the arduino is connected to a PC with internet connection, but other suggestions without pc are welcome."

You might make your pc available by using your network address, such as 192.168.x.x, instead of local host 127.0.0.0. Then change your network setup to allow access to your pc. Don't expect things to be instantaneous thru a networked setup.

pylon:
If you want to use the PC for the Internet connection you must install some software there that does the forwarding of the data to your actual webserver.

What software would you recommend? I 'll look into this: https://www.npmjs.com/package/localtunnel

zoomkat:
You might make your pc available by using your network address, such as 192.168.x.x, instead of local host 127.0.0.0. Then change your network setup to allow access to your pc. Don't expect things to be instantaneous thru a networked setup.

I found my local ip and connected to this from another pc also connected to the same local network, but this does not seem to work. It renders the website fine on the second PC but it does not respond to the button presses on the one connected to arduino. Do you think this just due to javascript being client side? or do I need to change something in my network settings?

"Let say I want the color of the background to change when i push a physical button. "

Are you expecting to push a button connected to an arduino and have the background color of a web page displayed on a remote computer change? That may not work as you expect. You would probably need a toggle function in your server code and need the web page to refresh to display the new color.

What software would you recommend? I 'll look into this: https://www.npmjs.com/package/localtunnel

No, that package won't work. I have some doubts that you'll find a ready-to-use software package for that part.

Read my first answer to find suggestions how to solve this.