1

I'm trying to program AtTiny13 using Arduino IDE. I have connected the atTiny to my PC using USBasp programer.

I want to write a simple blink application to test whether it works or not. Which pins should I blink?

2 Answers 2

1

You'll need an Arduino library that supports that chip, to make it appear in the Tools > Board list. The library docs will tell you which pins then correspond to which Arduino digital I/Os. From that you can decide which pin to attach an LED to (with resistor) and how to edit the blink sketch.

Example: http://www.instructables.com/id/Pimp-Your-Chocolates-with-Arduino-IDE-and-ATtiny13/step2/Program-the-ATtiny13/

12
  • There's already Attiny13 in the menu. Should I then just use pins 1-8? Commented Jul 1, 2014 at 22:43
  • 1
    You could of course just try using software "pin 1" and seeing if that works... it's likely that this is ATTiny Port B bit 0 (PB0) which appears on physical pin 5 of the 8-pin DIP chip (see atmel.com/images/doc2535.pdf for other packages).
    – gwideman
    Commented Jul 1, 2014 at 22:53
  • 2
    For more insight, look at file pins_arduino.h for the ATTiny13 somewhere within your ...\arduino\hardware\arduino\??? directory. I am assuming that at some point you added the core definition files that included ATTiny13, as I don't have them on my machine. Note that different core definitions could assign the Arduino pins to different physical pins.
    – gwideman
    Commented Jul 1, 2014 at 22:55
  • 1
    avrdude -p t13 -t ... should return device signature. See nongnu.org/avr-libc/user-manual/using_avrprog.html and this tutorial looks helpful tho not for t13: ladyada.net/learn/avr/avrdude.html
    – gwideman
    Commented Jul 1, 2014 at 23:21
  • 1
    And presumably you have docs: nongnu.org/avrdude/user-manual/avrdude.html, specifically command line flags: nongnu.org/avrdude/user-manual/…
    – gwideman
    Commented Jul 1, 2014 at 23:23
1

Because pins 0 and 1 (physical 5,6) are PWM's you should keep them for later ... and you still have A3 and A2 for analogWrite so, you should use Pin 2 (Physical 7, next to +5V) like this :

add this in the setup function

pinMode(2, OUTPUT);

And add this in your loop function:

digitalWrite(2,HIGH);

In case you forget

For reference : SparkFun's Help guide

Remember : Physical pin "1", reset, has a dot marked on it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.