Skip to main content
Notice removed Canonical answer required by CommunityBot
Bounty Ended with PhillyNJ's answer chosen by CommunityBot
Tweeted twitter.com/StackArduino/status/1232138432366993408
Notice added Canonical answer required by OrElse
Bounty Started worth 100 reputation by OrElse
deleted 4 characters in body; edited title
Source Link
dda
  • 1.6k
  • 1
  • 12
  • 18

How can i setupI set up outputs without using digitalWrite?

Consider the following:

#define IN1 9
#define IN2 10

pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);

void LeftMotor(Direction direction)
  {
  digitalWrite(IN1, direction == Forward ? LOW : HIGH);
  digitalWrite(IN2, direction == Forward ? HIGH : LOW);
}

How can iI modify the LeftMotorLeftMotor method to achieve the same result without using digitalWrite?

How can i setup outputs without using digitalWrite?

Consider the following

#define IN1 9
#define IN2 10

pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);

void LeftMotor(Direction direction)
 {
  digitalWrite(IN1, direction == Forward ? LOW : HIGH);
  digitalWrite(IN2, direction == Forward ? HIGH : LOW);
}

How can i modify the LeftMotor method to achieve the same result without using digitalWrite?

How can I set up outputs without using digitalWrite?

Consider the following:

#define IN1 9
#define IN2 10

pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);

void LeftMotor(Direction direction) {
  digitalWrite(IN1, direction == Forward ? LOW : HIGH);
  digitalWrite(IN2, direction == Forward ? HIGH : LOW);
}

How can I modify the LeftMotor method to achieve the same result without using digitalWrite?

Source Link
OrElse
  • 57
  • 1
  • 2
  • 7

How can i setup outputs without using digitalWrite?

Consider the following

#define IN1 9
#define IN2 10

pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);

void LeftMotor(Direction direction)
{
  digitalWrite(IN1, direction == Forward ? LOW : HIGH);
  digitalWrite(IN2, direction == Forward ? HIGH : LOW);
}

How can i modify the LeftMotor method to achieve the same result without using digitalWrite?