Created
May 3, 2017 20:49
-
-
Save Jim-Holmstroem/75ecd61e9e04432382ecda684d662023 to your computer and use it in GitHub Desktop.
Control anaog VU-meter from arduino (with calibraiations for my VU-meter)
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(115200); | |
} | |
// 0=> 0 | |
// 47=> 100 | |
// 94=> 200 | |
// 141=> 300 (still following 47 * n) | |
// 192=> 400 (1 mark off) | |
// 246=> 500 (2 mark off) | |
static int MIN_METER = 0; | |
static int MAX_METER = 246; | |
void loop() { | |
int value = Serial.parseInt(); | |
if(value != 0) { | |
value = value; | |
Serial.println(value); | |
analogWrite(5, value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment