I am trying to get my ADC values in a comma seperated format. In doing so, I have tried to include #include “sstream” and when I go to build the project, I get the following error:
/home/dlaroche/ESP32C3_Dual_Wifi/main/continuous_read_main.c:5:10: fatal error: sstream: No such file or directory
5 | #include
| ^~~~~~~~~
compilation terminated.
When using the autocomplete in VScode, it does identify or see the sstream as a possible include file, however, the compiler is seeming to have issues with the use of sstream. Is there any work around to this? Here is the code that is trying to utilize sstream:
while (1) {
ret = adc_continuous_read(handle, result, EXAMPLE_READ_LEN, &ret_num, 0);
**stringstream ss;**
if (ret == ESP_OK) {
for (int i = 0; i < ret_num; i += SOC_ADC_DIGI_RESULT_BYTES) {
adc_digi_output_data_t *p = (adc_digi_output_data_t*)&result[i];
uint32_t chan_num = EXAMPLE_ADC_GET_CHANNEL(p);
uint32_t data = EXAMPLE_ADC_GET_DATA(p);
if (chan_num < SOC_ADC_CHANNEL_NUM(EXAMPLE_ADC_UNIT)) {
**ss << chan_num << "," << data << ",";**
}
}
**std::string result_str = ss.str();
if (!result_str.empty()) {
result_str.pop_back();
}
ESP_LOGI(TAG, "ADC Values: %s", result_str.c_str());**
}
}