Created
December 4, 2013 19:52
-
-
Save boxysean/7794362 to your computer and use it in GitHub Desktop.
why don't i get better resolution when i pwm?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define PWM_PIN 2 | |
#define BIT_RESOLUTION_READ 12 | |
#define BIT_RESOLUTION_WRITE 12 | |
void setup() { | |
pinMode(PWM_PIN, OUTPUT); | |
analogWriteResolution(BIT_RESOLUTION_WRITE); | |
analogReadResolution(BIT_RESOLUTION_READ); | |
Serial.begin(9600); | |
} | |
void loop() { | |
for (int i = 0; i <= 16; i++) { | |
analogWrite(PWM_PIN, i); | |
Serial.println(i); | |
delay(400); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment