]> granicus.if.org Git - esp-idf/commitdiff
Changed adc GPIO pin 32, that is not broken out on header in ESP-WROVER-KIT, to 34
authorkrzychb <krzychb@gazeta.pl>
Tue, 18 Jul 2017 19:10:06 +0000 (21:10 +0200)
committerkrzychb <krzychb@gazeta.pl>
Tue, 18 Jul 2017 19:11:22 +0000 (21:11 +0200)
examples/peripherals/adc/README.md
examples/peripherals/adc/main/adc1_test.c

index de1532e2107334f3126b485d20b7524074f26803..36ebfc63a4e29f160c675b8b13ff5203ecd8a429 100644 (file)
@@ -1,17 +1,14 @@
 # Example: ADC1
 
-This test code shows how to configure ADC1 and how to use ADC1 get the voltage.
+This test code shows how to configure ADC1 and read the voltage connected to GPIO pin.
 
  
-####ADC1 functions:
+### ADC1 functions:
 
- * ADC1,CHANNEL_4:GPIO32, voltage range [0v,3.1v],the Data range [0,4095]
+ADC1_CHANNEL_6: GPIO34, voltage range [0V..3.1V], the data range [0..4095]
 
  
-####Test:
- * Please connect the test voltage to GPIO32
-
-
+### Test:
 
+Please connect the test voltage to GPIO34
 
index c8f4068346148094d744694f814f4e0a8f73cb7b..26996936514ca15892739fbb389f4dda8d3a4c7c 100644 (file)
 #include "driver/gpio.h"
 #include "driver/adc.h"
 
-#define ADC1_TEST_CHANNEL (4)
+#define ADC1_TEST_CHANNEL (ADC1_CHANNEL_6)
 
 void adc1task(void* arg)
 {
     // initialize ADC
     adc1_config_width(ADC_WIDTH_12Bit);
-    adc1_config_channel_atten(ADC1_TEST_CHANNEL,ADC_ATTEN_11db);
+    adc1_config_channel_atten(ADC1_TEST_CHANNEL, ADC_ATTEN_11db);
     while(1){
         printf("The adc1 value:%d\n",adc1_get_voltage(ADC1_TEST_CHANNEL));
         vTaskDelay(1000/portTICK_PERIOD_MS);