Santi07 / arduino-tiny

Automatically exported from code.google.com/p/arduino-tiny
Other
0 stars 0 forks source link

delayMicroseconds() for Attiny85 at 1Mhz not working #53

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Program an Attiny85 to 1 Mhz

Blink and LED at delay(20) the blink and LED at delayMicrosecond(20*1000);

The blink delay for delayMicroseconds is super slow.

I'm the most recent download 0013 with Arduino 1.0.1.

If I change the bootloader/fuse settings to 8 Mhz it works fine.

Example code:
void setup()
{
  pinMode(SERVO_PIN, OUTPUT);
  pinMode(LED_PIN, OUTPUT);
  for (int ii = 0; ii < 2; ii++)
  {
    digitalWrite(LED_PIN, HIGH);
    delay(500);
    digitalWrite(LED_PIN, LOW);
    delay(500);
  }
    for (int ii = 0; ii < 50; ii++)
  {
    digitalWrite(LED_PIN, HIGH);
    delay(20);
    digitalWrite(LED_PIN, LOW);
    delay(20);
  }
    for (int ii = 0; ii < 2; ii++)
  {
    digitalWrite(LED_PIN, HIGH);
    delay(500);
    digitalWrite(LED_PIN, LOW);
    delay(500);
  }
     for (int ii = 0; ii < 50; ii++)
  {
    digitalWrite(LED_PIN, HIGH);
    delayMicroseconds(lenMicroSecondsOfPeriod);
    digitalWrite(LED_PIN, LOW);
    delayMicroseconds(lenMicroSecondsOfPeriod);
  }
     for (int ii = 0; ii < 2; ii++)
  {
    digitalWrite(LED_PIN, HIGH);
    delay(1000);
    digitalWrite(LED_PIN, LOW);
    delay(1000);
  }

}

Original issue reported on code.google.com by rick.rickanderson on 28 May 2012 at 3:26

GoogleCodeExporter commented 8 years ago
Until it can be fixed in version 2, use _delay_us.

Original comment by arduino....@gmail.com on 28 May 2012 at 7:38