#【Beetle ESP32 C6 Mini Development Board】ADC and Bluetooth First Experience## One ADC chip has only one 12-bit ADC channel, which leads to three channels 4 5 6 as shown in the figure below
The joystick needs to continuously sample two ADC channels. The sampling xy coordinate wiring is shown in the figure
The demo is in the sdk's `examples/ble_handle/main/continuous_read_main.c`. Slightly modify the sampling rate of channels 4 and 5 to reduce the length of each READ and improve real-time performance. The modified parts are as follows``` #define EXAMPLE_READ_LEN 16 static adc_channel_t channel[2] = {ADC_CHANNEL_4, ADC_CHANNEL_5}; adc_continuous_handle_cfg_t adc_config = { .max_store_buf_size = 256, .conv_frame_size = EXAMPLE_READ_LEN, }; ESP_ERROR_CHECK(adc_continuous_new_handle(&adc_config, &handle)); adc_continuous_config_t dig_cfg = { .sample_freq_hz = 1 * 1000, .conv_mode = EXAMPLE_ADC_CONV_MODE, .format = EXAMPLE_ADC_OUTPUT_TYPE, }; ``` Then you can get the sample value in time
## Second Bluetooth If you want to use the development board as a Bluetooth device, you can refer to `examples/bluetooth/esp_hid_device/main/esp_hid_device_main.c` The default example uses the Bluedroid protocol HID. Compile and run on the phone. Connecting the device will alternately set the sound addition and subtraction at intervals
To simulate other devices such as mouse devices, in this example, macro control is always used to configure menuconfig according to EXAMPLE_MOUSE ``` CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y CONFIG_EXAMPLE_MOUSE_ENABLE=y CONFIG_BT_ENABLED=y CONFIG_BT_NIMBLE_ENABLED=y CONFIG_BT_CONTROLLER_DISABLED=y ``` Then compile and run
Match the ESP device on the mobile phone and enter the pairing code 123456 to connect
There are many demos related to Bluetooth and network. The demos provided are also very comprehensive and excellent SDK~~