saving . . . saved how digital value can be written by analogWrite command? has been deleted. how digital value can be written by analogWrite command? has been hidden .
how digital value can be written by analogWrite command?
Title
Question
analogWrite(fwdbuttonState == LOW ? ICpin2 : ICpin7, motorValue);

in above line how motor value (digital value) can be written by analogWrite cammond?

also in video two line are as 
analogWrite(fwdbuttonState == LOW ? ICpin2 : ICpin7, motorValue);
digitalWrite(fwdbuttonState == LOW ? ICpin7 : ICpin2, motorValue);

whereas in source code lines are as 
analogWrite(fwdbuttonState == LOW ? ICpin2 : ICpin7, motorValue);
digitalWrite(fwdbuttonState == LOW ? ICpin7 : ICpin2, LOW);

why discrepancy like this ?

also why you have used analogWrite in above line and digitalWrite in below line? why it is not digitalWrite in both lines?

relpy soon...





Arduino Pulse-Width-Modulation 08-09 min 40-50 sec 23-06-21, 11:47 p.m. nirav2009ec@gmail.com

Answers:

Since we have used potentiometer to vary the speed of the rotating motor, we required to use analogWrite command, as that command changes the value depending on the duty cycle we provide. We needed to use analogWrite command in one of the two above mentioned line of codes.
06-07-21, 6:50 p.m. Pratikjb11


Thanks for pointing the mistake. We will update the source code file.

The code shown in the video is correct.

analogWrite(fwdbuttonState == LOW ? ICpin2 : ICpin7, motorValue);
digitalWrite(fwdbuttonState == LOW ? ICpin7 : ICpin2, motorValue);

15-07-21, 4:22 p.m. NirmalaVenkat


Log-in to answer to this question.