ATtiny13 vs ATtiny85 met als voorbeeld blink met 3 ledjes

hallo
ik heb om te proberen 5 ATtiny13 gekocht om te proberen.
nu heb ik gewoon blink met 3 ledjes die werkt prima op ATtiny85.
maar met ATtiny13 totaal verschil, ik heb al millis gebruikt,want delay kon problemen geven.
maar welke instelling ik ook probeer van ATtiny13 het werkt niet
ik heb deze ATTiny13 core die op deze site besproken word voor arduino 1.6.4
http://forum.arduino.cc/index.php?topic=89781.msg2234412#msg2234412

en dit is de code die ik nu heb ,wat moet ik daar aan aanpassen om het goed werkend te krijgen???

/* Blink without Delay

Turns on and off a light emitting diode(LED) connected to a digital
pin, without using the delay() function. This means that other code
can run at the same time without being interrupted by the LED code.

The circuit:

  • LED attached from pin 13 to ground.
  • Note: on most Arduinos, there is already an LED on the board
    that's attached to pin 13, so no hardware is needed for this example.

created 2005
by David A. Mellis
modified 8 Feb 2010
by Paul Stoffregen

This example code is in the public domain.

http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay
*/

// constants won't change. Used here to
// set pin numbers:
const int ledPin = 0;
const int ledPin1 = 1;
const int ledPin2 = 2;

// Variables will change:
int ledState = LOW; // ledState used to set the LED
long previousMillis = 0; // will store last time LED was updated

// the follow variables is a long because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long interval = 1000; // interval at which to blink (milliseconds)

void setup() {
// set the digital pin as output:
pinMode(ledPin, OUTPUT);
pinMode (ledPin1,OUTPUT);
pinMode(ledPin2,OUTPUT);
}

void loop()
{
// here is where you'd put code that needs to be running all the time.

// check to see if it's time to blink the LED; that is, if the
// difference between the current time and last time you blinked
// the LED is bigger than the interval at which you want to
// blink the LED.
unsigned long currentMillis = millis();

if(currentMillis - previousMillis > interval) {
// save the last time you blinked the LED
previousMillis = currentMillis;

// if the LED is off turn it on and vice-versa:
if (ledState == LOW)
ledState = HIGH;
else
ledState = LOW;

// set the LED with the ledState of the variable:
digitalWrite(ledPin, ledState);
digitalWrite(ledPin1, ledState);
digitalWrite(ledPin2, ledState);
}
}

opgelost met deze code en met een attiny13 op 9.6 mhz

// Which pins are connected to which LED

const byte LED1 = 0;

const byte LED2 = 1;

const byte LED3 = 2;

// Assigning delays.

const unsigned long LED1_interval = 25;

const unsigned long LED2_interval = 50;

const unsigned long LED3_interval = 100;

// Declaring the variables holding the timer values for each LED.

unsigned long LED1_timer;

unsigned long LED2_timer;

unsigned long LED3_timer;

// Setting 3 digital pins as output pins and resetting timer

void setup ()

{

pinMode (LED1, OUTPUT);

pinMode (LED2, OUTPUT);

pinMode (LED3, OUTPUT);

LED1_timer = millis ();

LED2_timer = millis ();

LED3_timer = millis ();

} // end of setup

//LED1 loop that turns it ON if it is OFF and vice versa

void toggle_LED1 ()

{

if (digitalRead (LED1) == LOW)

digitalWrite (LED1, HIGH);

else

digitalWrite (LED1, LOW);

// remember when we toggled it

LED1_timer = millis ();

} // end of toggleLED_1

//LED2 loop

void toggle_LED2 ()

{

if (digitalRead (LED2) == LOW)

digitalWrite (LED2, HIGH);

else

digitalWrite (LED2, LOW);

// remember when we toggled it

LED2_timer = millis ();

} // end of toggle_LED2

//LED 3 loop

void toggle_LED3 ()

{

if (digitalRead (LED3) == LOW)

digitalWrite (LED3, HIGH);

else

digitalWrite (LED3, LOW);

// remember when we toggled it

LED3_timer = millis ();

} // end of toggle_LED3

void loop ()

{

// Handling the blink of LED1.

if ( (millis () - LED1_timer) >= LED1_interval)

toggle_LED1 ();

// Handling the blink of LED2.

if ( (millis () - LED2_timer) >= LED2_interval)

toggle_LED2 ();

// Handling the blink of LED3.

if ( (millis () - LED3_timer) >= LED3_interval)

toggle_LED3 ();

/* Other code that needs to execute goes here.

It will be called many thousand times per second because the above code

does not wait for the LED blink interval to finish. */

}

is opgelost, boards.txt van attiny13 aangepast en perfect werkend nu

gonnie08:
is opgelost, boards.txt van attiny13 aangepast en perfect werkend nu

Als je iets aanpast dat mogelijk handig is voor anderen, is het ook heel handig als je verteld wat je hebt aangepast.

sorry dat ik dat niet gelijk neer gezet heb.
ik kwam dit op internet ergens tegen
Change “attiny13.build.f_cpu=9600000” to “attiny13.build.f_cpu=1000000”
en dat zo aangepast
geen fout meldingen meer van attiny13 (was eerst wel zo,maar het werkte wel)
en de zelfde snelheid nu als attiny85