Zeroplus Arduino starter kit with Logic Analyzer Manual page 85

Table of Contents

Advertisement

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

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Arduino starter kit with Logic Analyzer and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents