
Edit:.......which offcourse is because I am trying to get the formatted string on the screen, and the float variable "voltsfl" on the serial monitor, duh.
So "sprintf" fails somehow, but why?
Code: Select all
volts=1023;
float voltsfl = (float)volts * calib;
String s = String(voltsfl, 3); // the second parameter, 3, is the number of decimal places
Serial.println(s.c_str());
Code: Select all
char str_volts[16];
float volts;
float calib = 1.0;
volts = 4.1234;
volts *= calib;
String s = String(volts, 3); // 3 decimal places
strcpy(str_volts, s.c_str());
Ah, too bad...I was hoping to avoid the wiring to the vcc and gnd pins of the board, but it seems I am stuck with it. Vcc is the main problem, I have to wire it to the oled, to the pot that serves as voltage divider and keeping it available for the input wire and the power connection during (re-)programming. Oh well....Phil_G wrote: ↑17 Sep 2019, 12:37 It would be fine Max but A6 and A7 dont have digital circuitry (only A0 to A5 can be used as digitals) consequently you cant set them high and low for vcc and ground.
Since they are input-only, you could externally hard wire them to ground and vcc (3v3 in this case)