-
1Turn on Experimental Features in chrome*
Enter the following line in your chrome (browser) address bar
chrome://flags/#enable-experimental-web-platform-features
Click the Disabled dropdown for Experimental Web Platform features and select Enabled
*https://www.chromestatus.com/feature/6577673212002304
I am curious about the firefox skepticism
-
2Upload code to Arduino
Use this code to prepare your Arduino for serial communication with the browser:
String incoming = ""; void setup() { pinMode(LED_BUILTIN, OUTPUT); Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } Serial.println("Serial is READY"); } void loop() { if (Serial.available() > 0) { incoming = Serial.readString(); delay(5); if (incoming == "LON" || incoming == "1") { digitalWrite(LED_BUILTIN, HIGH); Serial.println("LED is ON"); } if (incoming == "LOFF" || incoming == "0") { digitalWrite(LED_BUILTIN, LOW); Serial.println("LED is OFF"); } Serial.print("Serial READ: "); Serial.println(incoming); } //delay(10); }
You will need to use a current Arduino IDE or other methods to flash this to your board at this time but feel free to make your own customization.
-
3Go to Glitch.com
Check out https://hello-arduino-from-chrome.glitch.me/ to test the functionality. You can even remix your own interface from there.
-
4Connect Arduino to port
Connect your device to the computer and click connect in the browser.
-
5Select your Serial Device
-
6Send a message to your device
Based on the code we uploaded to our Arduino we should see that our device is ready. We can send "LON" or a 1 to turn on the built in LED and send "LOFF" or 0 to turn it off (no quotes when you enter those commands)
At the very least you can send a "Hello" and see that it responds.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.