#include "Wire.h"
#define SDA_pin 9
#define SCL_pin 10
#define SDA_pin_Lolin 23
#define SCL_pin_Lolin 19
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32-C3!");
chip_info();
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
}
void chip_info() {
// Get chip info
uint32_t chipId = 0;
String chipModel = ESP.getChipModel();
for(int i=0; i<17; i=i+8) {
chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
}
Serial.printf("ESP32 Chip model = %s Rev %d\n", ESP.getChipModel(), ESP.getChipRevision());
Serial.printf("This chip has %d cores\n", ESP.getChipCores());
Serial.print("Chip ID: "); Serial.println(chipId);
Serial.print("Chip Model: "); Serial.println(chipModel);
// Wire.setPins(SDA_pin, SCL_pin);
if (chipModel == "ESP32-C3") {
Serial.println("Detected ESP32-C3 ID? Uses 9 and 10 pins");
Wire.setPins(SDA_pin, SCL_pin);
} else if (chipModel == "ESP32-D0WDQ6") {
Serial.println("Detected Lolin32 lite ID? Uses 23 and 19 pins");
Wire.setPins(SDA_pin_Lolin, SCL_pin_Lolin);} else {
Serial.print("Default ESP32C3 Use 9 and 10 pins");
Wire.setPins(SDA_pin, SCL_pin);
}
Wire.begin();
}