Skip to content

Instantly share code, notes, and snippets.

@Jim-Holmstroem
Created April 30, 2017 16:52
Show Gist options
  • Save Jim-Holmstroem/2a9d2aa84e17d3f728a38294802592ce to your computer and use it in GitHub Desktop.
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
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