about open browser on computer

hi guys:
I have a question. Is that possible for using Arduino Leonardo or Arduino Pro Micro (ATmega32U4) to open browser on my laptop or desktop? I mean maybe also open other software. If it's possible, what kind of library I can use or any example code to make it possible?

The Leonardo and Micro can be programmed to send keystrokes to a PC. If you can do what you want from a keyboard it should be possible from a Leonardo or Micro.

...R

You can use the Arduino to send keyboard shortcuts to your computer which will be set to trigger the desired action. If you're using Windows you can do it like this:

  • Create a shortcut for the program you want to set the keyboard shortcut for
  • Right click on the shortcut
  • Click "Properties"
  • Click "Keyboard shortcut"
  • Type the shortcut you want to assign. I like to use combinations that wouldn't be used by other programs or accidentally pressed(something like Ctrl+Alt+Shift+F2).
  • Click "OK"

You can also add command line arguments to the "Target" field if desired. I'm sure this is just as easy to do on other OS.

As for example code, see File > Examples > 09. USB > Keyboard and:
https://www.arduino.cc/en/Reference/MouseKeyboard

Pert, Is that possible to use USB to do serial.Write() to send PC, Mac or Linux a message to open browser?

Not using the technique I described above. You would use the Keyboard library with keyboard.press(). If you're using an ATmega32U4 based board I think that's the best approach. If you do want to use Serial then you'll need a program running on the PC to receive the serial communication and then start the browser. You could write something yourself. I think I remember forum member Robin2 has shared some Python code for this. You could also use the excellent windows program EventGhost to do this quite easily, in fact that program could also be controlled via the keyboard approach if you wanted the ability to do more complex tasks than can be done easily with the instructions from my previous post. I'd guess there are similar programs for other operating systems.

This is my Python - Arduino demo. I believe it will work on Windows if you enter the correct serial port reference in the Python program.

…R

Pert, Is that possible to use USB to do serial.Write() to send PC, Mac or Linux a message to open browser?

Without an application listening to the serial port, the bits will just pile up on the floor.

With an application listening to the serial port, the application can do whatever you need it to do.

So, what application is listening to the serial port? The OS is NOT.

PaulS, you mention the Serial port, you mean USB or Arduino Serial Port?

I believe he means an application running on your PC listening for data coming from the Arduino.

...R

K, thank you guys so much.