saving . . . saved Kindly explain code line inside if statement has been deleted. Kindly explain code line inside if statement has been hidden .
Kindly explain code line inside if statement
Title
Question
analogWrite(fwdbuttonState == LOW ? ICpin2 : ICpin7, motorValue);
                
digitalWrite(fwdbuttonState == LOW ? ICpin7 : ICpin2, motorValue);

kindly give explanation for these two lines, how can we change directions we have not used bckbuttonState variable.

Arduino Pulse-Width-Modulation 08-09 min 30-40 sec 06-03-23, 11:41 a.m. itinepaorganizer

Answers:

The if statement includes an OR condition, where it compares if either of fwdbuttonState or bckbuttonState is LOW.

Since we have used potentiometer to vary the speed of the motor, we used the analogWrite command, as this  command changes the value depending on the duty cycle we provide. It is required to use the analogWrite command in one of the two above mentioned line of codes. So depending on which button is pressed, the code gets executed.
08-03-23, 4:19 p.m. pratikjb9485


Log-in to answer to this question.