Created
April 20, 2018 23:06
-
-
Save vilaca/8bc29f9139285f861d9b39b1c93e13b8 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
/* | |
2 pots 1 speaker | |
BOM | |
Arduino Uno | |
10k A0 | |
10k A1 | |
Pin 13 is output | |
*/ | |
void setup() { | |
pinMode(LED_BUILTIN, OUTPUT); | |
Serial.begin(9600); | |
} | |
void loop() { | |
int stepL = analogRead(0) + 1; | |
int i = (analogRead(1)+1) / 16 ; | |
i = i / 4; | |
i=i *4; | |
for (int j = 0; j < stepL / ((analogRead(1)+1) / 16); j++) | |
{ | |
int ii = i/2; | |
delay ( ii); | |
digitalWrite(LED_BUILTIN, HIGH); | |
delay ( ii); | |
digitalWrite(LED_BUILTIN, LOW); | |
stepL = analogRead(0); | |
// i = analogRead(1) / 16 ; | |
Serial.println(ii); | |
Serial.println(i); | |
Serial.println(j); | |
Serial.println(); | |
} | |
delay (stepL ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment