Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Pin verbunden mit SH_CP des 74HC595
- int shiftPin = 8;
- //Pin verbunden mit ST_CP des 74HC595
- int storePin = 9;
- //Pin verbunden mit DS des 74HC595
- int dataPin = 10;
- int counter = 1;
- int counter2 = 8 ;
- int poti = 0;
- int mintime = 10;
- void setup() {
- // Pins 8,9,10 OUT
- pinMode(storePin, OUTPUT);
- pinMode(shiftPin, OUTPUT);
- pinMode(dataPin, OUTPUT);
- }
- void loop () {
- digitalWrite(storePin, LOW);
- shiftOut(dataPin, shiftPin, MSBFIRST, counter + counter2);
- digitalWrite(storePin, HIGH);
- // Potentiometer zwischen 0 und 1023)
- poti = analogRead(0);
- delay(mintime+poti/4);
- counter = counter * 2;
- if (counter > 255) {
- counter = 1;
- }
- counter2 = counter2 * 2;
- if (counter2 > 255) {
- counter2 = 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment