Create ‘hardware’ folder in Arduino sketch folder, unzip the file.
Download the Smeezekitty core, http://sourceforge.net/projects/ard-core13/files/latest/download
Unzip it, copy the files, paste in …/hardware/attiny/avr/variants/core13/ (if folder didn’t exist, create it)
edit the boards.txt files at
…/hardware/attiny/avr/boards.txt
boards.txt
menu.cpu=Processor
menu.clock=Clock
attiny.name=ATtiny
attiny.bootloader.tool=arduino:avrdude
attiny.bootloader.unlock_bits=0xff
attiny.bootloader.lock_bits=0xff
attiny.build.core=arduino:arduino
attiny.build.board=attiny
attiny.upload.tool=arduino:avrdude
#attiny.upload.tool=usbasp
#################################################
attiny.menu.cpu.attiny13=ATtiny13
attiny.menu.cpu.attiny13.upload.maximum_size=1024
attiny.menu.cpu.attiny13.build.mcu=attiny13
attiny.menu.cpu.attiny13.build.variant=core13
attiny.menu.clock.internal96=9.6MHz (internal)
attiny.menu.clock.internal96.bootloader.low_fuses=0x7A
attiny.menu.clock.internal96.bootloader.high_fuses=0xff
attiny.menu.clock.internal96.build.f_cpu=9600000L
################################################
attiny.menu.clock.internal48=4.8MHz (internal)
attiny.menu.clock.internal48.bootloader.low_fuses=0x79
attiny.menu.clock.internal48.bootloader.high_fuses=0xff
attiny.menu.clock.internal48.build.f_cpu=4800000L
################################################
avrdude give the error because my downloader need -B4 option (I installed new bootloader, flash it, remove auto sck, so the avrdude warning gone)
In order to be able to upload it to ATTiny13A, we have to edit the file.
Macintosh HD/Applications/Arduino/Contents/Java/Hardware/arduino/avr/programmers.txt
edit it
usbasp.name=USBasp
usbasp.communication=usb
usbasp.protocol=usbasp
usbasp.program.protocol=usbasp
usbasp.program.tool=avrdude
usbasp.program.extra_params=-Pusb -B4
start arduino IDE
it give firewall warning
so
undo the edit or reinstall the arduino
create programmers.txt in the same folder with boards.txt
usbasp.name=USBaspN
usbasp.communication=usb
usbasp.protocol=usbasp
usbasp.program.protocol=usbasp
usbasp.program.tool=avrdude
usbasp.program.extra_params=-Pusb -B4
we use USBaspN
Blink without delay,
const int ledPin = 1; // the number of the LED pin
int ledState = LOW; // ledState used to set the LED
unsigned long previousMillis = 0; // will store last time LED was updated
const long interval = 1000; // interval at which to blink (milliseconds)
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop()
{
unsigned long currentMillis = millis();
if(currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
if (ledState == LOW)
ledState = HIGH;
else
ledState = LOW;
digitalWrite(ledPin, ledState);
}
}
For some reason, the delay on LED seem longer than 1 s (but it worked). Maybe it’s the same reason the blink example (with delay.) didn’t work
No comments:
Post a Comment