diff options
Diffstat (limited to 'chrome/test/data')
-rw-r--r-- | chrome/test/data/extensions/api_test/serial/api/background.js | 7 | ||||
-rw-r--r-- | chrome/test/data/extensions/api_test/serial/api/serial_arduino_test.ino | 17 |
2 files changed, 22 insertions, 2 deletions
diff --git a/chrome/test/data/extensions/api_test/serial/api/background.js b/chrome/test/data/extensions/api_test/serial/api/background.js index e241d56..76e9239 100644 --- a/chrome/test/data/extensions/api_test/serial/api/background.js +++ b/chrome/test/data/extensions/api_test/serial/api/background.js @@ -136,8 +136,11 @@ var testSerial = function() { } if (portNumber < ports.length) { serialPort = ports[portNumber]; - console.log('Connecting to serial device at ' + serialPort); - chrome.experimental.serial.open(serialPort, onOpen); + var bitrate = 57600; + console.log('Connecting to serial device ' + serialPort + ' at ' + + bitrate + ' bps.'); + chrome.experimental.serial.open(serialPort, {bitrate: bitrate}, + onOpen); } else { // We didn't find a port that we think we should try. chrome.test.succeed(); diff --git a/chrome/test/data/extensions/api_test/serial/api/serial_arduino_test.ino b/chrome/test/data/extensions/api_test/serial/api/serial_arduino_test.ino new file mode 100644 index 0000000..5fcb894 --- /dev/null +++ b/chrome/test/data/extensions/api_test/serial/api/serial_arduino_test.ino @@ -0,0 +1,17 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <Arduino.h> + +// This Arduino sketch is used for manual testing with the browser test +// SerialApiTest.SerialExtension. We have tested with Arduino IDE 1.0.1. + +void setup() { + Serial.begin(57600); +} + +void loop() { + if (Serial.available() > 0) + Serial.print((char)Serial.read()); +} |