Circuit 6, Both Interrupts
In this circuit, we have both styles of interrupt from before available at the same time (edge based and pin change based). A second button was added to do this. The code uses two ISRs, one for each button in the circuit. The code is simple and allows for some modification to test the “ISR_NOBLOCK” flag which is talked about.
Circuit 7, Switch Debounce
This is an interesting one. They use the timer interrupt to increase the counter after a short amount of time based on the clock prescaler. This is interesting to me as they have a 10ms delay in the main for loop to slow things down some more. I also don’t really know how it works though as I don’t get what triggers the timer overflow. I think it’s got something to do with the clock, but it’s not 100% clear I guess.
I tried to implement my own counter as a part of the bonus goal, but couldn’t quite figure it out.
Circuit 8, Counting Button
This one is pretty easy. It takes the same code from above and just adds some counting logic for the buttons/LEDs. One button increases the counter, the other outputs whatever was counted on the first button and then clears the count. They do use the Pin Change interrupt for counting the button presses, which means needing to divide the count in two.
The bonus goal was to display on one LED multiples of fives and on the second LED any ones that are left over. It was actually pretty easy, but nice to see that I can do some stuff.
Circuit 9, Shift Register
Really not much to say here. It just uses a CD4094 with a 8 resistor SIL package to drive the 8 LEDs. But not much is done with the code, just writing a fixed value.
Circuit 10, ADC
A lot of new terms/labels for the ATtiny were introduced here to get the ADC running. It all makes sense for the most part. Just a lot of terms to remember. But at least I have the handy code to look back to, to understand what to do.
The extra makes sense now that I looked at the other comments, but man, I was so confused for so long on it. It asked to change the LED output from one of the four LEDS based on the ADC read from 0 – 255 to a binary output, but for some reason, it just didn’t click with me.