|
| 1 | +/********************************************************************* |
| 2 | + This is an example for our Feather Bluefruit modules |
| 3 | +
|
| 4 | + Pick one up today in the adafruit shop! |
| 5 | +
|
| 6 | + Adafruit invests time and resources providing this open source code, |
| 7 | + please support Adafruit and open-source hardware by purchasing |
| 8 | + products from Adafruit! |
| 9 | +
|
| 10 | + MIT license, check LICENSE for more information |
| 11 | + All text above, and the splash screen below must be included in |
| 12 | + any redistribution |
| 13 | +*********************************************************************/ |
| 14 | + |
| 15 | +/* |
| 16 | + * This sketch demonstrate how to use Hardware Serial1 along with |
| 17 | + * native USB Serial on Bluefruit nRF52840. |
| 18 | + * Note: Bluefruit nRF52832 does not support Serial1 |
| 19 | + */ |
| 20 | + |
| 21 | +#include "Arduino.h" |
| 22 | + |
| 23 | +void setup() |
| 24 | +{ |
| 25 | + // Open serial communications and wait for port to open: |
| 26 | + Serial.begin(115200); |
| 27 | + while ( !Serial ) delay(10); // for nrf52840 with native usb |
| 28 | + |
| 29 | + Serial.println("Goodnight moon!"); |
| 30 | + |
| 31 | + // set the data rate for the SoftwareSerial port |
| 32 | + //mySerial.begin(9600); |
| 33 | + //mySerial.println("Hello, world?"); |
| 34 | + |
| 35 | + Serial1.begin(115200); |
| 36 | + Serial1.println("Hello, world?"); |
| 37 | +} |
| 38 | + |
| 39 | +void loop() // run over and over// |
| 40 | +{ |
| 41 | + if (Serial1.available()) |
| 42 | + Serial.write(Serial1.read()); |
| 43 | + |
| 44 | + if (Serial.available()) |
| 45 | + Serial1.write(Serial.read()); |
| 46 | +} |
0 commit comments