Use this example to open a webpage using a push button, you need Python installed on your Windows.
Step 01:
Upload this sketch to your arduino:
const int buttonPin = 2; // the number of the pushbutton pin
int buttonState = 0;
void setup() {
Serial.begin(9600);
pinMode(buttonPin, INPUT);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
Serial.println("OpenWebPage");
}
}
The Circuit:
- pushbutton attached to pin 2 from +5V
- 10K resistor attached to pin 2 from ground

Step 02:
Open a text editor and paste this code to a new file:
import serial
from subprocess import call
ser = serial.Serial(
port='COM5', # Change this to your COM port number
baudrate=9600,
parity=serial.PARITY_ODD,
stopbits=serial.STOPBITS_TWO,
bytesize=serial.SEVENBITS
)
if (ser.isOpen()):
print "Serial Port is Open..."
print "Waiting for a command ..."
while 1:
cmd = ser.readline()
if cmd.strip() == "OpenWebPage":
print "Received command from Arduino..."
print "Opening webpage..."
call(["explorer", "http://www.google.com"]) #change it the address you want
Save the file to your desktop, name it : SerialListener.py
Step 03
- Now open a Command Prompt window.
- Navigate to your desktop folder and execute this command:
python SerialListener.py.
- You should see Serial Port is Open... Waiting for a command ...
- Press the push button, and a webpage should open in your default browser.