Skip to main content
Removed thanks, as per SE policy
Source Link
Greenonline
  • 3.2k
  • 7
  • 37
  • 49

I am building a project using an Arduino Nano. In it, I am using pin 3 as PWM output. However, If I supply values lower than 255 to it, the pin does not output any voltage at all.

According to this diagram, pin 3 is PWM. :

NANO pinout I

I have tested it on 2two boards, it doesn't function on either one. It's not my sketch, either (I tested it with a simple analogWrite();analogWrite();).

This is the code:

void setup() {
  // put your setup code here, to run once:
  #define E1 3  // Enable Pin for motor 1
  #define E2 10  // Enable Pin for motor 2
  #define I1 4  // Control pin 1 for motor 1
  #define I2 2  // Control pin 2 for motor 1
  #define I3 A1  // Control pin 1 for motor 2
  #define I4 A0  // Control pin 2 for motor 2
}

void loop() {
  // put your main code here, to run repeatedly:
  // I use differential steering, speed is important
  analogWrite(E1, 100); // Run in full speed
  analogWrite(E2, 100); // Run in full speed

  // always go forward
  digitalWrite(I1, LOW);
  digitalWrite(I2, HIGH);
  digitalWrite(I3, LOW);
  digitalWrite(I4, HIGH);
}

What could be the reason of this?

Thanks for your help!

I am building a project using an Arduino Nano. In it, I am using pin 3 as PWM output. However, If I supply values lower than 255 to it, the pin does not output any voltage at all.

According to this diagram, pin 3 is PWM. NANO pinout I have tested it on 2 boards, it doesn't function on either one. It's not my sketch, either (I tested it with a simple analogWrite();).

This is the code:

void setup() {
  // put your setup code here, to run once:
  #define E1 3  // Enable Pin for motor 1
  #define E2 10  // Enable Pin for motor 2
  #define I1 4  // Control pin 1 for motor 1
  #define I2 2  // Control pin 2 for motor 1
  #define I3 A1  // Control pin 1 for motor 2
  #define I4 A0  // Control pin 2 for motor 2
}

void loop() {
  // put your main code here, to run repeatedly:
  // I use differential steering, speed is important
  analogWrite(E1, 100); // Run in full speed
  analogWrite(E2, 100); // Run in full speed

  // always go forward
  digitalWrite(I1, LOW);
  digitalWrite(I2, HIGH);
  digitalWrite(I3, LOW);
  digitalWrite(I4, HIGH);
}

What could be the reason of this?

Thanks for your help!

I am building a project using an Arduino Nano. In it, I am using pin 3 as PWM output. However, If I supply values lower than 255 to it, the pin does not output any voltage at all.

According to this diagram, pin 3 is PWM:

NANO pinout

I have tested it on two boards, it doesn't function on either one. It's not my sketch, either (I tested it with a simple analogWrite();).

This is the code:

void setup() {
  // put your setup code here, to run once:
  #define E1 3  // Enable Pin for motor 1
  #define E2 10  // Enable Pin for motor 2
  #define I1 4  // Control pin 1 for motor 1
  #define I2 2  // Control pin 2 for motor 1
  #define I3 A1  // Control pin 1 for motor 2
  #define I4 A0  // Control pin 2 for motor 2
}

void loop() {
  // put your main code here, to run repeatedly:
  // I use differential steering, speed is important
  analogWrite(E1, 100); // Run in full speed
  analogWrite(E2, 100); // Run in full speed

  // always go forward
  digitalWrite(I1, LOW);
  digitalWrite(I2, HIGH);
  digitalWrite(I3, LOW);
  digitalWrite(I4, HIGH);
}

What could be the reason of this?

Post Migrated Here from electronics.stackexchange.com (revisions)
Source Link
Mu3
  • 113
  • 1
  • 1
  • 4

Arduino Nano PWM pin not functioning

I am building a project using an Arduino Nano. In it, I am using pin 3 as PWM output. However, If I supply values lower than 255 to it, the pin does not output any voltage at all.

According to this diagram, pin 3 is PWM. NANO pinout I have tested it on 2 boards, it doesn't function on either one. It's not my sketch, either (I tested it with a simple analogWrite();).

This is the code:

void setup() {
  // put your setup code here, to run once:
  #define E1 3  // Enable Pin for motor 1
  #define E2 10  // Enable Pin for motor 2
  #define I1 4  // Control pin 1 for motor 1
  #define I2 2  // Control pin 2 for motor 1
  #define I3 A1  // Control pin 1 for motor 2
  #define I4 A0  // Control pin 2 for motor 2
}

void loop() {
  // put your main code here, to run repeatedly:
  // I use differential steering, speed is important
  analogWrite(E1, 100); // Run in full speed
  analogWrite(E2, 100); // Run in full speed

  // always go forward
  digitalWrite(I1, LOW);
  digitalWrite(I2, HIGH);
  digitalWrite(I3, LOW);
  digitalWrite(I4, HIGH);
}

What could be the reason of this?

Thanks for your help!