Hi Pauls,
Now I am working on a Peizo sensor project.
When no any force is applied on the sensor's surface, the arduino will read the voltage of the sensor via Pin A0. When I press the sensor's surface, the code should judge the action as a "Press" and the flag "PressStatus" should be high.At the same time I need to drive the sensor vibration via PWM SineWave.
When I make my program only generate sine wave, the Peizo sensor can generate vibration (the vibration is what I want). However When I add some conditions, like press judges (PressStatus) in my modified code, the Peizo sensor only produce some weak vibrations or just voice When I press the sensor. Obviously I can find the flag "PressStatus" is high when I press the sensor. That means my "judge press" code should be right. But
I have tested my coding with oscilloscope, there is only one wave instead of holding for the press duration when I press the sensor.
What can I do next?
Emergency...
Thks a lot