CODE EXPLANATION
•
analogWrite(motorPin, 160)
generate an analog signal, the "analog pins" (A0 to A5) can
generate a PWM. That's why we use them in this experiment because
DC motors can easily be controlled with a PWM.
•
float millivolts= (read_voltage/1024.0) * 5000. AnalogWrite()
AnalogWrite() has a resolution of 5 volts divided into 1024
values which equals to a 4.88mV step. By multiplying the value
read by analogWrite() with its resolution we can retrieve the
voltage in millivolt. For example if analogWrite() reads 100 we
can calculate that the voltage measured is 100*4.88mV = 488mV
Although the Arduino board cannot
84
Need help?
Do you have a question about the Arduino starter kit with Logic Analyzer and is the answer not in the manual?