There is a lot more to this experiment than inverting phase. But its a great project.
Small speakers have a cone radiation pattern that is not very linear with phase over a wide range of frequencies. The phase shift occurs with wall reflections, 12 to 24dB/octave crossover filters and also your choice of microphone and its direction will affect all your results contributing to measurement errors.
Ticky tacky details...
In RF we call it Friis Loss where power loss for some beamwidth drops inverse to the square of the distance from geometry. So conduct the experiment with the greatest distance possible so that phase and thus relative distance measurements are more about phase cancelling at high f and short wavelengths than attenuation due to doubling the distance which complicates your computed results. If you amplify the mic audio into a square wave and do the same with the source, you can use an XOR gate and LPF or any phase detector or PLL to measure the actual phase difference independent of amplitude changes.
Ideally one would use two high quality matched planar speakers ( expensive) or two tweeters as resolution increases with frequency.
Then doing a sound test like good headphones a MONO sound source should sound like it originates in the center of your head. If so then when you invert the speaker polarity on one side MONO sound should sound silent at the optimum center phase and amplitude cancelled position where you would place a microphone at right angles to verify a matched amplitude "and" phase of the combined dual pressure waves into one mic. For example most music has the main voices in MONO and the other sounds and stereo so when reversed the main voice, drums bass and anything else in MONO is attenuated. Target 30 dB for a reasonable attenuation or cancellation when out of phase and accept -20dB reduction if not possible.
The nearest sound reflector must be much greater and attenuated (curtains) than the line of sight distance between sound emitter and detector.
So just choose two matched tweeters and don't use USB, just analog output and don't push the levels to distortion using a scope on the speaker and mic for verification.
Use Audacity for a sound sine wave source with a slow log sine sweep, then choose the best frequency for phasing inside your head or quietest cancelled out of phase. To simulate Radar you can consider a staircase or swept audio burst as they do for RF in chirp RADAR to obtain even better results.
tmi https://sound-au.com/ptd.htm#s51
You could use it to detect the phase inversion off a wall with one speaker and microphone which is a really big RADAR target. Then with a very narrow beam megaphone reduce the scattering effects and send bursts to measure wall distance from the echo times and or phase reversal using CHIRP AUDIO to simulate Chirp Radar. Food for thought.
Some USB cam Mics might work for this experiment
Logitech and others also have a speaker amplitude calibration test to equalize the stereo speakers using chirp audio bursts on alternate speakers and also swept sine. But this may affect phasing.
CAM Mics generally do not have rear passive "voice cancellation" like some desktop mics sothey are better for "far-field" sound measurements ( conference room) but worse for wall reflection echos.