Skip to main content
replaced http://arduino.stackexchange.com/ with https://arduino.stackexchange.com/
Source Link

On your code, you using analogRead but declaring the pin (A3) as output. Change it to pinMode(A3,INPUT);

Aside from that, PWM is basically a digital output which changing (HIGH and LOW) at specified frequency. When the result you got is

0 0 1022 1021 0 1022 1021 0 0 1021 0 1021 1021 0 0 1021 0 0 1022

There's nothing wrong. 0 --> LOW, and 1021++ --> HIGH
If you want "measure" something from the PWM, use pulseIn() instead, you can check the documentation here.

If you want to measure the PWM value, I suggest you read:
Can I connect a PWM pin on one Arduino to an analog input on another?Can I connect a PWM pin on one Arduino to an analog input on another?

On your code, you using analogRead but declaring the pin (A3) as output. Change it to pinMode(A3,INPUT);

Aside from that, PWM is basically a digital output which changing (HIGH and LOW) at specified frequency. When the result you got is

0 0 1022 1021 0 1022 1021 0 0 1021 0 1021 1021 0 0 1021 0 0 1022

There's nothing wrong. 0 --> LOW, and 1021++ --> HIGH
If you want "measure" something from the PWM, use pulseIn() instead, you can check the documentation here.

If you want to measure the PWM value, I suggest you read:
Can I connect a PWM pin on one Arduino to an analog input on another?

On your code, you using analogRead but declaring the pin (A3) as output. Change it to pinMode(A3,INPUT);

Aside from that, PWM is basically a digital output which changing (HIGH and LOW) at specified frequency. When the result you got is

0 0 1022 1021 0 1022 1021 0 0 1021 0 1021 1021 0 0 1021 0 0 1022

There's nothing wrong. 0 --> LOW, and 1021++ --> HIGH
If you want "measure" something from the PWM, use pulseIn() instead, you can check the documentation here.

If you want to measure the PWM value, I suggest you read:
Can I connect a PWM pin on one Arduino to an analog input on another?

added 759 characters in body
Source Link
duck
  • 1.3k
  • 10
  • 27

On your code, you using analogRead but declaring the pin (A3) as output. Change it to pinMode(A3,INPUT);

Aside from that, PWM is basically a digital output which changing (HIGH and LOW) at specified frequency. When the result you got is

0 0 1022 1021 0 1022 1021 0 0 1021 0 1021 1021 0 0 1021 0 0 1022

There's nothing wrong. 0 --> LOW, and 1021++ --> HIGH
If you want "measure" something from the PWM, use pulseIn() instead, you can check the documentation here.

If you want to measure the PWM value, I suggest you read:
Can I connect a PWM pin on one Arduino to an analog input on another?

On your code, you using analogRead but declaring the pin (A3) as output. Change it to pinMode(A3,INPUT);

On your code, you using analogRead but declaring the pin (A3) as output. Change it to pinMode(A3,INPUT);

Aside from that, PWM is basically a digital output which changing (HIGH and LOW) at specified frequency. When the result you got is

0 0 1022 1021 0 1022 1021 0 0 1021 0 1021 1021 0 0 1021 0 0 1022

There's nothing wrong. 0 --> LOW, and 1021++ --> HIGH
If you want "measure" something from the PWM, use pulseIn() instead, you can check the documentation here.

If you want to measure the PWM value, I suggest you read:
Can I connect a PWM pin on one Arduino to an analog input on another?

Source Link
duck
  • 1.3k
  • 10
  • 27

On your code, you using analogRead but declaring the pin (A3) as output. Change it to pinMode(A3,INPUT);