add while for serial connection to all examples for nrf52840 native usb

This commit is contained in:
hathach committed 2018-10-30 00:48:45 +07:00
1 parent e79a1f0547
commit 5580249807
54 files changed
+83 -18

No files matched your search

@@ -24,6 +24,7 @@ BLEClientUart clientUart;
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 Central BLEUART Example");
Serial.println("-----------------------------------\n");
@@ -83,6 +83,7 @@ uint8_t connection_num = 0; // for blink pattern
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
// Initialize blinkTimer for 100 ms and start it
blinkTimer.begin(100, blink_timer_callback);
@@ -35,6 +35,7 @@ BLEClientCharacteristic bslc(UUID16_CHR_BODY_SENSOR_LOCATION);
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 Central Custom HRM Example");
Serial.println("--------------------------------------\n");
@@ -30,6 +30,7 @@ hid_mouse_report_t last_mse_report = { 0 };
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 Central HID (Keyboard + Mouse) Example");
Serial.println("--------------------------------------------------\n");
@@ -17,6 +17,7 @@
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 Central Scan Example");
Serial.println("--------------------------------\n");
@@ -21,6 +21,7 @@
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 Central ADV Scan Example");
Serial.println("------------------------------------\n");
@@ -58,6 +58,7 @@ BLEClientCharacteristic opticalCharacteristicPeriod(SENSORTAG_OPTICAL_PERIOD_CHA
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 Central TI Sensor Tag Example");
Serial.println("-----------------------------------------\n");
@@ -30,6 +30,7 @@ BLEClientUart clientUart;
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 Dual Role BLEUART Example");
Serial.println("-------------------------------------\n");
@@ -4,6 +4,7 @@ float mv_per_lsb = 3600.0F/1024.0F; // 10-bit ADC with 3.6V input range
void setup() {
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
}
void loop() {
@@ -58,6 +58,7 @@ uint8_t mvToPercent(float mvolts) {
void setup() {
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
// Get a single ADC sample and throw it away
readVBAT();
@@ -18,6 +18,8 @@
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 Firmware Info Example");
Serial.println("---------------------------------\n");
}
@@ -32,6 +32,8 @@ void setup() {
// Init hardware UART <-> Serial Monitor
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("GPS echo test");
// Init Software Uart <-> GPS FeatherWing
@@ -10,6 +10,7 @@ typedef volatile uint32_t REG32;
void setup() {
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit 52 HW Info");
Serial.println("");
@@ -56,6 +56,7 @@ int pins[12] =
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
// Add 4 pins into a group
// It is better to add Pin before call .begin()
@@ -18,7 +18,7 @@
void setup()
{
Serial.begin(115200);
while ( !Serial ) {} // for nrf52840 with native usb
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 Memory Info Example");
Serial.println("-------------------------------\n");
@@ -17,6 +17,8 @@
void setup() {
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 NFC to GPIO Pin Config");
Serial.println("----------------------------------\n");
if ((NRF_UICR->NFCPINS & UICR_NFCPINS_PROTECT_Msk) == (UICR_NFCPINS_PROTECT_NFC << UICR_NFCPINS_PROTECT_Pos)){
@@ -778,7 +778,9 @@ void systemResetCallback()
void setup()
{
Serial.begin(115200);
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 Standard Firmata via BLEUART Example");
Serial.println("------------------------------------------------\n");
@@ -32,6 +32,8 @@ void setup()
pinMode(PIN_ADV, INPUT_PULLUP);
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 Advanced Advertising Example");
Serial.println("----------------------------------------\n");
@@ -37,6 +37,8 @@ const char* CAT_STR [] =
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 BLE ANCS Example");
Serial.println("----------------------------\n");
@@ -34,6 +34,7 @@ BLEBeacon beacon(beaconUuid, 0x0000, 0x0000, -54);
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 Beacon Example");
Serial.println("--------------------------\n");
@@ -40,6 +40,8 @@ byte note_sequence[] = {
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Adafruit Bluefruit52 MIDI over Bluetooth LE Example");
// Config the peripheral connection with maximum bandwidth
@@ -24,7 +24,7 @@ SoftwareTimer blinkTimer;
void setup()
{
Serial.begin(115200);
while( !Serial ) {} // only needed for nRF52840
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 BLEUART Example");
Serial.println("---------------------------\n");
@@ -17,6 +17,7 @@
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 Blinky Example");
Serial.println("--------------------------\n");
@@ -23,6 +23,8 @@
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 Clear Bonds Example");
Serial.println("-------------------------------\n");
@@ -33,6 +33,8 @@ BLEClientCts bleCTime;
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 BLE Client Current Time Example");
Serial.println("-------------------------------------------\n");
@@ -27,6 +27,8 @@ extern uint8_t packetbuffer[];
void setup(void)
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println(F("Adafruit Bluefruit52 Controller App Example"));
Serial.println(F("-------------------------------------------"));
@@ -36,6 +36,8 @@ void disconnect_callback(uint16_t conn_handle, uint8_t reason);
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 HRM Example");
Serial.println("-----------------------\n");
@@ -34,6 +34,8 @@ void disconnect_callback(uint16_t conn_handle, uint8_t reason);
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 Heath Thermometer Example");
Serial.println("-------------------------------------\n");
@@ -21,6 +21,7 @@ EddyStoneUrl eddyUrl(-40, URL);
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 EddyStone URL Example");
Serial.println("---------------------------------\n");
@@ -29,6 +29,7 @@ void setup()
pinMode(PIN_SHUTTER, INPUT_PULLUP);
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 HID Camera Shutter Example");
Serial.println("--------------------------------------\n");
@@ -21,7 +21,7 @@ bool hasKeyPressed = false;
void setup()
{
Serial.begin(115200);
while ( !Serial ) {} // for nrf52840 with native usb
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 HID Keyboard Example");
Serial.println("--------------------------------\n");
@@ -37,6 +37,7 @@ bool keyPressedPreviously = false;
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 HID Keyscan Example");
Serial.println("-------------------------------\n");
@@ -21,6 +21,7 @@ BLEHidAdafruit blehid;
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 HID Mouse Example");
Serial.println("-----------------------------\n");
@@ -67,8 +67,10 @@ BLEUart bleuart;
void setup()
{
Serial.begin(115200);
Serial.println(F("Adafruit Bluefruit NeoMatrix"));
Serial.println(F("----------------------------"));
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Adafruit Bluefruit NeoMatrix");
Serial.println("----------------------------");
Serial.println();
Serial.println("Please connect using Bluefruit Connect LE application");
@@ -49,6 +49,8 @@ BLEUart bleuart;
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Adafruit Bluefruit Neopixel Test");
Serial.println("--------------------------------");
@@ -33,6 +33,8 @@ BLEUart bleuart;
void setup(void)
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 Throughput Example");
Serial.println("------------------------------\n");
@@ -107,6 +107,7 @@ void test_homekit(void)
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 Homekit Light Bulb Example");
Serial.println("--------------------------------------\n");
@@ -139,6 +139,8 @@ node_record_t records[ARRAY_SIZE];
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 Central Proximity Example");
Serial.println("-------------------------------------\n");
@@ -51,6 +51,8 @@ BLEUuid uuid = BLEUuid(CUSTOM_UUID);
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 Peripheral Proximity Example");
Serial.println("----------------------------------------\n");
@@ -18,7 +18,7 @@
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("ExternalFS Format Example");
Serial.println();
@@ -26,7 +26,7 @@
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("ExternalFS List Files Example");
@@ -24,7 +24,7 @@ File file (ExternalFS);
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("External Read Write File Example");
Serial.println();
@@ -18,7 +18,7 @@
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("InternalFS Format Example");
Serial.println();
@@ -26,10 +26,7 @@ void setup()
// Wait for user input to run.
Serial.println("This sketch will destroy all of your data in External Flash!");
Serial.print("Enter any keys to continue:");
while ( !Serial.available() )
{
delay(1);
}
while ( !Serial.available() ) delay(1);
Serial.println();
Serial.println();
@@ -37,13 +34,14 @@ void setup()
InternalFS.begin();
Serial.print("Formating ...");
delay(1);
Serial.flush();
// Format without erase
// Pass true for full external flash erasing (take time)
InternalFS.format(true);
Serial.println("Done");
delay(1);
Serial.flush();
}
// the loop function runs over and over again forever
@@ -26,7 +26,7 @@
void setup()
{
Serial.begin(115200);
while ( !Serial ) {} // for nrf52840 with native usb
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("InternalFS List Files Example");
@@ -24,7 +24,7 @@ File file(InternalFS);
void setup()
{
Serial.begin(115200);
while ( !Serial ) {} // for nrf52840 with native usb
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Internal Read Write File Example");
Serial.println();
@@ -21,6 +21,8 @@
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 HW Rotary Encoder Callback Example");
Serial.println("----------------------------------------------\n");
@@ -21,6 +21,8 @@
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 HW Rotary Encoder Polling Example");
Serial.println("---------------------------------------------\n");
@@ -23,6 +23,8 @@ SwRotaryEncoder swEncoder;
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 SW Rotary Encoder Callback Example");
Serial.println("----------------------------------------------\n");
@@ -23,6 +23,8 @@ SwRotaryEncoder swEncoder;
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 SW Rotary Encoder Polling Example");
Serial.println("---------------------------------------------\n");
@@ -39,6 +39,7 @@ const int chipSelectPin = 7;
void setup() {
Serial.begin(9600);
while ( !Serial ) delay(10); // for nrf52840 with native usb
// start the SPI library:
SPI.begin();
@@ -21,6 +21,8 @@ void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
@@ -31,6 +31,7 @@ void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
// Start each software serial port
portOne.begin(9600);
@@ -26,6 +26,7 @@ int off_count = 0;
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 BLEMIDI RX Test");
Serial.println("---------------------------\n");
@@ -33,6 +33,7 @@ unsigned long prev_off = millis();
void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 BLEMIDI TX Test");
Serial.println("---------------------------\n");