Beetle ESP32-C6
I am using a Beetle ESP32-C6 and am trying to get some simple AnalogReadSerial using Arduino 1.8.19
Beetle ESP32-C6
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A3);
// print out the value you read:
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
}
Arduino: 1.8.19 (Windows 10), Board: "DFRobot Beetle ESP32-C6, Disabled, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 160MHz (WiFi), QIO, 80MHz, 4MB (32Mb), 115200, None, Disabled, Disabled"
G:\Documents\Devcoop\DonLuc\Blog\HomeBot\DL2402Mk04\AnalogReadSerial\AnalogReadSerial.ino: In function 'void loop()':
AnalogReadSerial:22:32: error: 'A3' was not declared in this scope
22 | int sensorValue = analogRead(A3);
| ^~
exit status 1
'A3' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Beetle ESP32-C6
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(4);
// print out the value you read:
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
}
COM11
??????
FireBeetle 2 ESP32-E
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
}
COM3
10:52:33.530 -> 1677
10:52:38.531 -> 0
10:52:43.528 -> 0
10:52:48.522 -> 4095
10:52:53.518 -> 4095
10:52:58.513 -> 4095
10:53:03.515 -> 4095
10:53:08.507 -> 4095
10:53:13.507 -> 4095
10:53:18.519 -> 4095
10:53:23.510 -> 4095
Beetle ESP32-C6????
Beetle ESP32 C6
FireBeetle 2 ESP32-C6
Arduino IDE menus
Tools > USB CDC On Boot > Enabled
ESP32 family with native USB capability is that they are typically configured to have their USB CDC serial port disabled by default.
Luc.PaquinReplace A3 with the correct pin number based on your board’s pin mapping. For the Beetle ESP32-C6, analog pins are typically mapped directly by their numbers rather than the A0, A1, etc., convention used in some Arduino boards.You can edit your code like this:
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin (e.g., GPIO 4, which might be the correct analog pin):
int sensorValue = analogRead(4); // Change 4 to the correct pin number
// print out the value you read:
Serial.println(sensorValue);
delay(100); // delay in between reads for stability
}