Created
April 30, 2017 16:52
-
-
Save Jim-Holmstroem/2a9d2aa84e17d3f728a38294802592ce to your computer and use it in GitHub Desktop.
small program to drive vu-meter, and some calibration values for a specific one
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