Prvni ulozeni z chegewara githubu
This commit is contained in:
19
libraries/ESP32/examples/AnalogRead/AnalogRead.ino
Normal file
19
libraries/ESP32/examples/AnalogRead/AnalogRead.ino
Normal file
@ -0,0 +1,19 @@
|
||||
void setup() {
|
||||
// initialize serial communication at 115200 bits per second:
|
||||
Serial.begin(115200);
|
||||
|
||||
//set the resolution to 12 bits (0-4096)
|
||||
analogReadResolution(12);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// read the analog / millivolts value for pin 2:
|
||||
int analogValue = analogRead(2);
|
||||
int analogVolts = analogReadMilliVolts(2);
|
||||
|
||||
// print out the values you read:
|
||||
Serial.printf("ADC analog value = %d\n",analogValue);
|
||||
Serial.printf("ADC millivolts value = %d\n",analogVolts);
|
||||
|
||||
delay(100); // delay in between reads for clear read from serial
|
||||
}
|
Reference in New Issue
Block a user