Same as Arduino but tiny. ATtiny13 MCU only has 64bytes of usable RAM and 1kByte flash program storage. Only 6 IOs from PORTB.
Sketches have to be brief. We will use an Artou DevBoard with LEDs on B3 and B4.
MicroCore is a board package for Arduino to program for the ATtiny13 MCU. Follow the instructions at the MicroCore github page. Open menu File->Preferences and add Additional Boards Manager URL:
https://mcudude.github.io/MicroCore/package_MCUdude_MicroCore_index.json
Go to Tools->Boards and install MicroCore. Installation will take a moment while MicroCore adds a few files to the Arduino program.
These files are called cores. They map out a processor and features so that Arduino can compile code for new and different MCUs. Example: PB3 is a reserved keyword label for the fourth IO pin on the chip, PB4 is the fifth IO pin.
Select ATtiny13Menu Tools->Board->MicroCore->ATtiny13.
Look at bottom of Arduino IDE screen to make sure it is setup to program for the ATtiny13 MCU.
Enter this code for the sketch. It will toggle pins PB3 and PB4 on the ATtiny module. Our board has LEDs connected to these leads.
void setup() { pinMode(PB3,OUTPUT); pinMode(PB4,OUTPUT);}
void loop() { digitalWrite(PB3,HIGH);digitalWrite(PB4,LOW); delay(500);
digitalWrite(PB3,HIGH);digitalWrite(PB4,HIGH);delay(500);
digitalWrite(PB3,LOW); digitalWrite(PB4,HIGH);delay(500);
digitalWrite(PB3,LOW); digitalWrite(PB4,LOW); delay(500); }
Click the check mark and make sure that the sketch compiles okay. The ATtiny has only 1kB of flash memory to store programs, our blinky program uses 7% of that.
Arduino IDE menu Tools->Programmer select USBasp
Menu Sketch->Upload Using Programmer.
Comments