I check the 3.3V pin (pin 2) against the ground pin on the same column (pin 14) with a multimeter, I always read 3.3V even when pin 2 is set to LOW. What am I missing? Thanks.
The 3.3V pin (physical pin 17) is the output from a 3.3V step down voltage converter, not an I/O pin. The converter itself does have an enable pin, but it is permenantly enabled and not software controllable.
I/O pin 2 (physical pin 5) is what you're setting low in the code fragment you showed.
Doesn't matter though, since it seems the voltage output is not software controllable. Is it in any way possible to use the Nano 33 IoT to produce a controlled (programmed) High/Low voltage then (low must be 0V)?
Physical pin #s have no relationship with I/O pin#s, and the latter is what pinMode/digitalWrite/digitalRead et al use.
As far as the Arduino docs showing the physical pin #s being rotated 180 degrees, that's always made more sense to me. But it seems every time I look online I see it the other way round. Shrug.
If you're looking for a software controlled 3.3V regulator, I'm sure such a thing exists, though I've never had the need to look for one. (And now, having said that, of course they do - the 3.3V step down converter has an Enable pin - it's just not accessible in this setup.)
Any VALID GPIO pin will toggle between 0V and 3.3V when pinmode for that pin is OUTPUT. You get 0V by digitalWrite(pin, LOW) and you get 3.3V by digitalWrite(pin, HIGH) Keep in mind these pins are only good for a small amount of ma. The datasheet will tell you the exact amount, I think it's 40mA
I didn't know that! I have just read the voltage between GND and the I/O pin 2 in @van_der_decken 's message and it does indeed cycle between 0-3.3V with delay().
I'll select @van_der_decken 's answer as solution but I wish I could select both! Thanks all