/* 12 output LSDj pitch controle! By: Gijs Gieskes 2007 ------------------------------ LSDj clock output pins: 0, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13. Start/Stop button pin: 7. Pot pin: 0 (analog in) */ int analogValue = 0; // analog value int analogPin = 0; int SSButton = 7; int SSRead = 0; int led = 0; void setup(){ DDRB = B11111111; // set pins as output DDRD = B11111101; // set pins as output pinMode(SSButton, INPUT); // pushbutton as input digitalWrite(SSButton, HIGH); // turn pullup on } void loop(){ SSRead = digitalRead(SSButton); if (SSRead == LOW) { lsdjClock(); PORTD = B11111101; // led on analogValue = analogRead(analogPin); analogValue = 8+(analogValue/16); delay(analogValue); } PORTD = B10111101; // led off } void lsdjClock(){ for (int i=0; i <= 7; i++){ PORTB = B00000000; // all low PORTD = B10000000; // all low delayMicroseconds(62); // pauses for 62 microseconds PORTB = B11111111; // all high PORTD = B10111101; // all high exept TX pin 1 delayMicroseconds(62); // pauses for 62 microseconds } }