Read input pins

Hello. Im sorry maybe for this dumb question. How can I read two input at the same time? I have pin A0 for temperature and pin A1 to read voltage. I would like to read both a the same time in PHP.

You kind of can’t do simultaneous Analog reads right now, they are all single conversions. But the STM32 does support this feature so it’s possible to configure it to do what you want… just not easy.

The analog converter is very fast right now though, I think maybe a couple microseconds?

If you don’t care about simultaneous per say, but just need the two values in one read, try this:
sprintf(output, "%.2f,%.2f", temperature, voltage);

Should generate a string like:
"2.25,3.20" and is just exactly the right number of character to get around the 9-chars issue:

For simultaneous digital reads:

Check out my Fast Read example… it basically reads in the whole GPIO port at once:

Then you can mask off (AND operation) each pin or the port separately and test for HIGH (some value larger than 0), or LOW (0).