Arduino with AtTiny45

I am working on a circuit for use on RC planes. It will be nothing more than flashing LED’s. I require 3 outputs. Output 1 and 2 will contain 6 LED’s per output. I’ll be using the 12V strip LED’s. Output 3 will be a single LED. The single LED will be directly driven by the chip. The other 2 outputs will each drive a FET which will drive the strip LED’s.

I’d like to use the Tiny25/45/85 to do this as the 328 is overkill. I have read several threads showing how to program the chip itself. I saw something somewhere that stated that when using these chips with the Arduino that pin 1 of the chip isn’t pin 1 in the Arduino sketch. I’m somewhat confused as to how modify the blink sketch to reflect the correct AtTiny pins.

Any help will be appreciated.

From the pins_arduino.c file for the Attiny:

// ATMEL ATTINY45 / ARDUINO
//
//                  +-\/-+
// Ain0 (D 5) PB5  1|    |8  Vcc
// Ain3 (D 3) PB3  2|    |7  PB2 (D 2)  Ain1
// Ain2 (D 4) PB4  3|    |6  PB1 (D 1) pwm1
//            GND  4|    |5  PB0 (D 0) pwm0
//                  +----+

So it would seem that pin 6 on the chip itself is called D1 (pin 1) in a sketch. Similarly pin 5 on the chip is D0 and so on.

BTW pin 1 on the chip is the reset pin, although as you can see you can also use it as D5, but I imagine you have to set the fuses so that the reset function is disabled. Which of course means you can't reset it with a reset switch if you do so.

Thanks for the feedback. Therefore, my sketch should like like this :

/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.

This example code is in the public domain.
*/

void setup() {
// initialize the digital pin as an output.
// ATTINY45 Pins 5,6,7 have an LED connected:
pinMode(0, OUTPUT); //ATTINY45 Pin 5
pinMode(1, OUTPUT); //ATTINY45 Pin 6
pinMode(2, OUTPUT); //ATTINY45 Pin 7
}

void loop() {

digitalWrite(0, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(0, LOW); // set the LED off
delay(1000); // wait for a second
digitalWrite(1, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(1, LOW); // set the LED off
delay(1000); // wait for a second
digitalWrite(2, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(2, LOW); // set the LED off
delay(1000); // wait for a second
}

Can you post your code in [ code ] tags rather than [ quote ] tags? It looks better and handles thing like [ i ] better.

Without testing it, your sketch looks OK. How about testing?

Having said that, when I recently played with my Attiny85 I found that under certain circumstances (which I haven't nailed down) the delay () function didn't work. That is, there was no delay. So if the LEDs light up but don't seem to flash, that could be it. There is a delayMicroseconds function which uses a counted loop rather than timers which should work if this happens to you.

Sorry about that.

/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.

This example code is in the public domain.
*/

void setup() {
// initialize the digital pin as an output.
// ATTINY45 Pins 5,6,7 have an LED connected:
pinMode(0, OUTPUT); //ATTINY45 Pin 5
pinMode(1, OUTPUT); //ATTINY45 Pin 6
pinMode(2, OUTPUT); //ATTINY45 Pin 7
}

void loop() {

digitalWrite(0, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(0, LOW); // set the LED off
delay(1000); // wait for a second
digitalWrite(1, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(1, LOW); // set the LED off
delay(1000); // wait for a second
digitalWrite(2, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(2, LOW); // set the LED off
delay(1000); // wait for a second
}

Edit your post. Select the code. Hit the "#" button above the input area. That will put the code into "code" format.

/*
  Blink
 Turns on an LED on for one second, then off for one second, repeatedly.
 
 This example code is in the public domain.
 */

void setup() {                
  // initialize the digital pin as an output.
  // ATTINY45 Pins 5,6,7 have an LED connected:
  pinMode(0, OUTPUT);  //ATTINY45 Pin 5
  pinMode(1, OUTPUT);  //ATTINY45 Pin 6
  pinMode(2, OUTPUT);  //ATTINY45 Pin 7
}

void loop() {

  digitalWrite(0, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(0, LOW);    // set the LED off
  delay(1000);              // wait for a second
  digitalWrite(1, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(1, LOW);    // set the LED off
  delay(1000);              // wait for a second
  digitalWrite(2, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(2, LOW);    // set the LED off
  delay(1000);              // wait for a second
}

Does it work? I'm not sure if you are asking a question now.

I have not tried it yet. I am simply wondering if the structure is correct.

I said earlier: