I started my first try in programming an ATTINY13 with my Arduino 2560.
Everything seemed fine, however when I wanted to run the blink example, my LED did not blink, it keeps lighting.
I am using 5V as input voltage.
I did not change the blink example except for the correct pin number.
All the wiring seems correct, when I change the pin number the LED stays dark, so my program is arriving propperly on the ATTINY.
If I start playing with the delays (delaymicroseconds) I get the LED to become darker.
The documentation of the ATTINY13 (www.atmel.com/images/doc2535.pdf) mentions a maximum clock frequency of 20MHz. When I choose the ATTINY13 from the Arduino IDE board menu it is listed with a 9.6MHz clock.
Could this be a reason? How can I adjust or take care of that?
----------- Edit:
I was starting with the default blink example (delay(1000)
).
I played with both, the normal delay
and the delayMicroseconds
.
The following codes dimmed the LED:
void setup() {
pinMode(3, OUTPUT);
}
void loop() {
digitalWrite(3, HIGH);
delayMicroseconds(10);
digitalWrite(3, LOW);
delayMicroseconds(1000);
}
Which makes me believe the LED is blinking very fast.
A similar sketch with normal delay
does not make the LED dim:
void setup() {
pinMode(3, OUTPUT);
}
void loop() {
digitalWrite(3, HIGH);
delay(1);
digitalWrite(3, LOW);
delay(100);
}
And as mentioned with the default blink sketch the LED nothing happens as well.
I also made the delay a ever increasing variable to see if something is happening, no luck. And I have 2 ATTINYs to test, same result for both...
--- Edit2:
Another try:
int led = 3;
void setup() {
pinMode(led, OUTPUT);
digitalWrite(led, HIGH);
delayMicroseconds(100);
digitalWrite(led, LOW);
}
void loop() {
}
Now I moved switching the LED on and off into the setup function. Strangely enough, by changing the delay between 1000 and 100 micro seconds, the LED gets lighter and darker...
---- Edit 3:
Here is my circuit:
And this is the ATTINY specific code I added to the Arduino IDE:
attiny13.name=ATtiny13 (internal 9.6 MHz clock)
attiny13.bootloader.low_fuses=0x7a
attiny13.bootloader.high_fuses=0xff
attiny13.upload.maximum_size=1024
attiny13.build.mcu=attiny13
attiny13.build.f_cpu=9600000L
attiny13.build.core=arduino:arduino
attiny13.build.variant=tiny8
delay()
in general because that is milliseconds