First of all A Happy new year to all,
Hoping that somebody who is good in arduino Programming can help out, First off I will do my best to explain and then ask a question or two and see if anyone out there can help, A good German Friend and arduino collegue has helped me modify an old German Arduino Project called "Blebetus House" where we used an arduino UNO to program an ATTINY85 IC to control 5 house lights (Leds) and the Simulated flickering of a TV (6th LED) using PWM, in a house or shop on a model railway.
As I said we have now modified this to make the flickering of the TV, a Color TV using 3 Leds instead of the original 1 Led, so as to still have the 5 house Lights (LED) we have managed to do this using a Shift Register 74HC595 (Or Rather my German Friend Has Coded This), as you can see in the code posted below he did this telling the shift register that:
unsigned int dataPin = 0; // Pin D0 verbunden mit DS von 74HC595 Pin14 SI
unsigned int clockPin = 1; // Pin D1 verbunden mit SH_CP von 74HC595 Pin11 SCK
unsigned int latchPin = 2; // Pin D2 verbunden mit ST_CP von 74HC595 Pin12 RCK
DataPin 14, ClockPin 11 & LatchPin 12 of the shift register come from pins 0, 1 & 2 of the ATTINY85
Thus Leaving pins 3, 4, and 5 of the ATTINY85 Free.
I asked my friend if we could use these pins to randomley turn on and off other Lights in the house as we do with pins 3,4,5,6 and 7 of the Shift Register 74HC595
const byte leds[] = {3, 4, 5, 6, 7}; // LED Pins für das normale Blinken deklarieren
He then answered that it would be better to use pins 3 and 4 of the ATTINY85 for the Shift Register as Pins 0 and 1 of the ATTINY85 are True PWM Pins and that would be better for the Leds. Thus Leaving us now with Pins 0,1 and 5 Of the ATTINY85 Free, He also told me that pin 5 Could not be used (I dont understand why not..?)
so here are my questions that I was unable to get clear with our german Friend Simpley because of the Language Barrier and a Shi....y Google Translation...:(
Firstley to Change the Code so that the DataPin, LatchPin and Clockpin of the Shift Register 74HC595 are as my german Friend Suggested would this be the Correct Code.?
unsigned int dataPin = 3; // Pin D3 verbunden mit DS von 74HC595 Pin14 SI
unsigned int clockPin = 4; // Pin D4 verbunden mit SH_CP von 74HC595 Pin11 SCK
unsigned int latchPin = 2; // Pin D2 verbunden mit ST_CP von 74HC595 Pin12 RCK
And More Importantley Can somebody please explain to me how I Have to code so that the ATTINY85 Understands Which Pins are on the Shift Register 74HC595, And Which Pins are on the ATTINY85 as we now have Pins 0 and 1 on the 74HC595 and pins 0 and 1 on the ATTINY85..??
After I Have more questions But lets go one by one
Best Regards to All and Thanks in advance
Carlos