#include <Arduino.h>
#include <tuple>
#include <utility>
// Helper function to convert tuple elements to strings
template<typename Tuple, size_t... N>
void tupToArrImpl(const Tuple& t, String* arr, std::index_sequence<N...>) {
((arr[N] = String(std::get<N>(t))), ...);
}
template<typename... Args>
void tupToArr(const std::tuple<Args...>& t, String* arr) {
tupToArrImpl(t, arr, std::make_index_sequence<sizeof...(Args)>{});
}
void dumpParams(int x, int y) {
Serial1.println(__func__);
}
void setup() {
Serial1.begin(9600);
dumpParams(); while (1) delay(1);
// Example tuple
auto myTuple = std::make_tuple(42, 3.14, "hello", true);
// Create array to hold strings
String strArray[4];
// Convert tuple to array
tupToArr(myTuple, strArray);
// Print results
for(int i = 0; i < 4; i++) {
Serial1.println(strArray[i]);
}
}
void loop() { delay(1); }