I’ve successfully programmed an ATTiny86 to do what I want it to do, following the various tutorials and starting with the modified “blink” sketch and pin assignments as shown here
both of which examples refer to ATTiny PB0/Pin 5 as Pin 0.
So in my sketch, as a reminder, I’ve included code thus (as per the Blink exercise)
#define PB0 0; #define PB1 1; #define PB2 2; const int RedLedPin = PB0; // set pin numbers const int YellowLedPin = PB1; const int BlueLedPin = PB2;
and then of course I have code like this
pinMode(RedLedPin, OUTPUT); //Pinmodes pinMode(YellowLedPin, OUTPUT); // pinMode(BlueLedPin, OUTPUT);
followed by code to write to the pins
And it works - the Red led on Pin 5 lights up when it is supposed to, as does the Yellow LED on pin 6 and the blue LED on pin 7.
BUT I don’t understand why when I am assigning them to pins 0, 1, and 2 respectively!
What happens when I want to use PB4/Pin 3 - what do I call it, pin 5 or pin 6?
Or is it that the #define statements are irrelevant and simply ignored by the compiler, so when I use PB4, I should refer to it as PB4 but don’t bother with the #define statement?
I have searched this forum, and other sites, but I haven’t got any clearer I’m afraid!