Hey Y'all. Im as green as it gets here. So don't get too tarzan on me.
Im trying to build a meditation timer. and I've been taking baby steps. So far I have successfully used a 5v signal to fire a 12v solenoid. I have ran a loop to count from 0 to 9 on a single 7 segment LED display using a shift register.
the next mile stone i wish to reach is to get down the interface with the single digit 7 segment led, the shift register and a rotary encoder. I would like the sketch so when the encoder is spun clockwise it will count to 9 and if spun counter-clockwise it will subtract to 0
this is what i am using 1
- 7 segment led (common cathode)
- ran by a SN74HC595N shift register
- rotary encoder with push button.
- all on a Digispark
I have been struggling with the interface between the rotary encoder and the shift register. I can't seem to find a good example of how to output (what i am calling) encoderValue to the led display
I also don't know where to put constrains on the counting like encoderValue must be <10 and >-1??
I feel like i need to insert this bit of code in the sketch but not sure where.
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, (encoderValue));
digitalWrite(latchPin, HIGH); delay(1000);
delay(1000);
could someone point out what i am totally doing wrong or maybe point me in a direction where someone may have already done this code before?
I've attached what i am trying to get to work
roatary_and_led_rev-A.ino (1.81 KB)