Test program for a LDR input with mapped values

master
Max Lehmann 5 years ago
parent 84dbab9e78
commit db482f23ef

@ -0,0 +1,21 @@
#define IN3 (A3)
int VAL3;
int MAP3;
int CONST;
void setup() {
Serial.begin(9600);
}
void loop() {
VAL3=analogRead(IN3);
Serial.print(VAL3);
MAP3 = map(VAL3, 70, 500, 10, 1200);
CONST = constrain(MAP3, 1, 1200);
tone(11, CONST);
Serial.print("\t");
Serial.print(MAP3);
Serial.print("\t");
Serial.println(CONST);
//delay(50);
}
Loading…
Cancel
Save