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
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.
-
There's already Attiny13 in the menu. Should I then just use pins 1-8?Tomáš Zato– Tomáš Zato2014年07月01日 22:43:02 +00:00Commented Jul 1, 2014 at 22:43
-
1You 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– gwideman2014年07月01日 22:53:03 +00:00Commented Jul 1, 2014 at 22:53
-
2For 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– gwideman2014年07月01日 22:55:05 +00:00Commented Jul 1, 2014 at 22:55
-
1avrdude -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.htmlgwideman– gwideman2014年07月01日 23:21:02 +00:00Commented Jul 1, 2014 at 23:21
-
1And presumably you have docs: nongnu.org/avrdude/user-manual/avrdude.html, specifically command line flags: nongnu.org/avrdude/user-manual/…gwideman– gwideman2014年07月01日 23:23:14 +00:00Commented Jul 1, 2014 at 23:23
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.