If you own an Arduino capable of WebUSB, you can directly communicate with a supporting website in your (webkit)-browser.
To setup your IDE follow these steps. But be sure not to modify your hardware/arduino/avr/cores/arduino/USBCore.h
(reason see here).
Download the content of the WebUSB Library. You'll need the hardware
and library
folders.
Instead take the hardware
-folder and copy it's content to [your_sdk_installation_directory]/hardware
and restart your IDE.
If done correctly, you should be able to see an option to select WebUSB devices.
Also copy the content of the library
-folder to [your-arduino-sketch-folder]/libraries
and restart your IDE.
If done correctly, you should be able to select the WebUSB Library to add to your sketch.
GameBoyPrinterEmulator.ino contains this code-block:
#if USB_VERSION == 0x210
#include <WebUSB.h>
WebUSB WebUSBSerial(1, "herrzatacke.github.io/gb-printer-web/#/webusb");
#define Serial WebUSBSerial
#endif
If everything is set up correctly and you select one of the WebUSB boards, the USB_VERSION
will be defined automatically, so that WebUSB.h
will automatically be included.
After uploading to your Arduino, you will not see any output in your IDE's serial monitor, instead you can use this demo page to see the output.
A notification should appear once the code is uploaded.
Also, this webtool will accept the serial output and render printed images visible in your browser.
You can check browser compatibility on caniuse.com