hi everyone, im a new user, and i do not know much about arduino. i wanted to see if anyone can help me with writing the code of finding the phase shift between two sine wave inputs operating at 60hz. any approach is fine
Do not cross-post. Other thread removed.
Start by working through the simple examples that come with the software development package (Arduino IDE), such as digitalRead, analogRead, etc.
It won't take long and you will need to be thoroughly familiar with those before you can apply them to this task.
Input the signals using analogRead(), and remember the time of each reading. Then find reference points in both signals, be zero crossing or min/max amplitude. Based on the times of the reference points you can calculate the phase shift.
The discrete steps in the measured amplitude and time may require some interpolation. You may be better off with using the analog comparator feature, that allows for better timing of the zero-crossing points. Alas this requires some low level programming.