Problem with programming digispark ATtiny85 board with Arduino IDE I have bought a Digispark ATtiny85 board to learn about that microcontroller. So I tried using internal register names in the code rather than using Arduino in built functions. I can get the board to work when comes just input and output operations. For example the below code works and I can get the on board LED to turn ON and OFF
#include&lt;avr/io.h&gt;
void setup()
{
  DDRB |=(1 &lt;&lt; PB1);  //set PB1 as output
}
void loop() {
 PORTB |= (1 &lt;&lt; PB1);    // Turning ON LED connected to PB1
 delay(1000);            //Using Arduino IDE inbuilt delay function to generate delay of 1 second
 PORTB &amp;= ~(1 &lt;&lt; PB1);   //Turning the LED off
 delay(1000);

}
I have tried using Timer0 of ATtiny85 module to generate time delay of one second. But unfortunately I couldn't get it to work.
#include&lt;avr/io.h&gt;
#define F_CPU 16500000UL
#include&lt;util/delay.h&gt;


void timer_config()
{
 DDRB =0b00000010; // set PB1 as output
 GTCCR|= (1&lt;&lt;TSM);      ///Halt the timer for configuration
 TCCR0A=0x00;             //Normal mode
 TCCR0B=0x00;
 TCCR0B |= (1&lt;&lt;CS00)|(1&lt;&lt;CS02);   //prescaling with 1024
 TCNT0=0;
 GTCCR&amp;=~(1&lt;&lt;TSM); //Start the timer
}

void tmdel()
{
 int i=0;
 while(i&lt;=6)
 {
  while((TIFR &amp; (1 &lt;&lt; TOV0) )==0);        //Waiting for 0-255 and flag to raise
  TIFR|=(1&lt;&lt;TOV0);      //Clear the flag
  i=i++;                          //increment by one
 }
}

int main()
{
 timer_config();
 while(1)
 {
  PORTB|=(1&lt;&lt;PB1);     //PortB1 high
  tmdel();                         //Delay of 1 second
  PORTB&amp;=~(1&lt;&lt;PB1);     //PORTB1 low
  tmdel();
 }
}

I have used the overflow flag to identify TCNT0 register status. I have uploaded the above code but the LED isn't responding as anticipated.
When searching the internet I have got few suggestions that this might be because Arduino IDE uses timer registers for delay function. When user attempts to access timer registers it might not work as intended.
But am not sure about the validity of above opinion. Can anyone help me with it? Since am learning this controller, practicing core programming is quite important. If I cannot program ATtiny85 using Arduino IDE this way, can someone suggest a way or alternate hardware setup to program ATtiny85 and access its registers without a problem.
i=i++;                          //increment by one


The result of the above statement is not defined. That is, it is not necessarily &quot;i + 1&quot;.
See:

http://en.wikipedia.org/wiki/Sequence_point
http://c-faq.com/expr/seqpoints.html

Instead use:
i++;

Or:
i = i + 1;

A note about &quot;undefined behavior&quot;:
http://en.wikipedia.org/wiki/Undefined_behavior

When an instance of undefined behavior occurs, so far as the language specification is concerned anything could happen, maybe nothing at all.