Mignon Potentiometer Metronome

Plug the potentiometer in your extensions port. The left and the right pin to GND and + 5 V and the pin in the middle to Pin 19.

This code plays a permanent rhythem, which can be controlled by the potentiometer.

#include <gamekit_2_1.h>

int angle; // variable for the senor value

void setup(){
gamekit.Begin();
}

void loop(){
angle = analogRead(5); // analog pin 4 is digital pin 18
gamekit.set_pixel(4,6,15); // turn dot on
gamekit.play_tone(1000, 15,LOUD); // play cheep
gamekit.set_pixel(4,6,0); // turn dot off
delay(angle * 10); // wait 0 – 10.240 milliseconds
}

© olaf val, 2018