bluetooth test — Xiao Esp32C6 simulation

An interactive Xiao Esp32C6 circuit simulation you can run free in your browser on Velxio, by danielolasunkami9.

Components

Sketch code

void setup() {
  Serial.begin(115200);
  Serial1.begin(9600, SERIAL_8N1, 17, 16);

  delay(500);
  Serial.println("Bluetooth serial test ready.");
  Serial.println("Type a character to send to the peer.");
}

void loop() {
  // Receive bytes from the simulated Bluetooth peer.
  while (Serial1.available()) {
    int c = Serial1.read();

    Serial.printf("Received: 0x%02X '%c'\n",
                  c, (c >= 32 && c <= 126) ? c : '.');
  }

  // Send characters typed into the Serial Monitor to the peer.
  while (Serial.available()) {
    char c = Serial.read();

    Serial1.write(c);
    Serial.printf("Sent: '%c' (0x%02X)\n",
                  (c >= 32 && c <= 126) ? c : '.', (uint8_t)c);
  }
}

More projects by danielolasunkami9