Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Adruino string and value concat
float v_s_r = analogRead(SUPP_VOLTAGE_PIN);
float supp_voltage = (5.0 / 1024) * v_s_r * 3.0;
String v_s = "supp_v:";
int v_s_str_len = v_s.length() + 1; //we need extra space for the null terminator thus len += 1
char v_s_send[v_s_str_len];
v_s.toCharArray(v_s_send, v_s_str_len);
bus.send(200, v_s_send, v_s_str_len - 1); // we don't want to send out the null terminator thus len -= 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment