ATTiny85 clock speed?


i have sketch:


digitalwrite(led_pin,1);
delay(100);
digitalwrite(led_pin,0);



i'have uploaded same sketch on same tiny different clock speed, , realized higher clock speed - higher real delay.

1mhz - fastest (minimal delay)

16mhz - slowest ( delay(100) led lit 2 sec)

am missing something? thought higher clock speed delay might shorter, not longer.  why?

hi maia

it because attiny85 running @ default 1mhz clock ship factory.

when clock speed on target board specify in arduino ide matched, delay accurate.  so attiny85 running @ 1mhz runs slower expected when sketch compiled 16mhz target loaded because clock using slower code internally expects.

to change clock, select 16mhz target , use 'burn bootloader' option in arduino ide.  this set internal fuses in microcontroller.  then use clock speed target uploading program , work advertised.

use 8mhz code on 1mhz pocessor 100ms delay becomes 800ms.  use 16mhz code on 1mhz microcontroller , 100ms becomes 1.6seconds.  that's you're seeing.

hope helps,
geoff


Arduino Forum > Using Arduino > Microcontrollers > ATTiny85 clock speed?


arduino

Comments

Popular posts from this blog

invalid use of void expresion in FlexiTimer2 library

error: a function-definition is not allowed here before '{' token

LED Strip Code