1. I would like to use function analogWrite() to change the voltage at the analog output port, say 100 or 200 times per second. How can I do that?
2. Also use function analogRead() to get the voltage at the analog input port, say 100 or 200 times per second. Is it the same as analogWrite()?
You can use tone() down to 31HzSays here you can analogRead() 10k times a second
By performing an analogWrite 100 or 200 times a second.Unlike a lot of the earlier Arduino boards the MKR1010 has a true digital to analogue converter, 10 bits, and so has a true analogue output. Without this you have to use PWM and an external filter.Yes.
as for the PWM, when I write sinusoidal waveform on the DAC port, the waveform looks like a sin wave on oscilloscope, you know up and then down, when I enlarge the time/div, I can see it is PWM clearly.
Your statement is full of contradictions. The DAC pin does not output pwm, so you would not see pwm. If you are not using the DAC pin, only a pwm pin without a filter, you would see only pwm and would not see a sine wave. I think you should post a schematic showing what is attached to the Arduino and where the 'scope probes are attached. Also the test code that is running, in code tags. Some screen grabs from the 'scope or pictures of the 'scope screen would also be helpful, showing the signals you mentioned.