Last active
November 24, 2020 22:03
-
-
Save pfn/68f82b06c9a3c3f9c13f657f0659cc5e to your computer and use it in GitHub Desktop.
This file contains 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
void setup() { | |
Serial.begin(9600); | |
pinMode(11, OUTPUT); | |
analogReference(DEFAULT); | |
} | |
void loop() { | |
static int lastValue = 0; | |
int value = analogRead(A0) >> 3; | |
if (lastValue != value) { | |
Serial.println(value); | |
analogWrite(11, min(255, 128 + value)); | |
lastValue = value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment