Skip to content

Instantly share code, notes, and snippets.

@vilaca
Created Apr 20, 2018
Embed
What would you like to do?
/*
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