Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Examples

Arduino/C++ Examples

The following examples demonstrate various features of this development board.

⚡ i2c: example1.ino

#include <Arduino.h>
#include "bme68xLibrary.h"
#include <Wire.h>

#define SDA_PIN 21
#define SCL_PIN 22

Bme68x bme;

void setup() {
  Serial.begin(115200);
  while (!Serial) delay(10);

  Wire.begin(SDA_PIN, SCL_PIN);
  Wire.setClock(100000);  // 100 kHz

  // ✅ Solo llama a begin, sin usar if
  bme.begin(0x77, Wire);

  // Verifica estado del sensor

📄 Ver código completo en GitHub

⚡ spi: example_spi.ino

#include <Arduino.h>
#include <SPI.h>
#include "bme68xLibrary.h"

// Pines personalizados para ESP32-C6
#define PIN_MOSI 7
#define PIN_MISO 2
#define PIN_SCK  6
#define PIN_CS   18

SPIClass mySPI(0);  // Bus SPI #0 para ESP32-C6
Bme68x bme;

void setup() {
  Serial.begin(115200);
  while (!Serial);

  // Inicializar SPI con pines personalizados
  mySPI.begin(PIN_SCK, PIN_MISO, PIN_MOSI, PIN_CS);

📄 Ver código completo en GitHub