AT first, I set the environment to use ATtiny with Arduino IDE.
I entered the following URL.
https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
Install "attiny by David A.Mellis" library.
Select a board type and programmer.
Board:ATtiny24/44/84 Processor:ATtiny44 Clock:External 20 MHz Programmer:AVRISP mk2
I connected my board with AVRISP mk2 and USB to serial converter, and then burned bootloader with Arduino IDE.
Before writing a program, I checked a data sheet of ATtiny24A/44A/84A to know the pin numbers that connected to each compornent.
I wrote a program that the LED shines only when I press the button. testLed.ino:
const int pinLed = 7;
const int pinButton = 3;
void setup() {
pinMode(pinLed, OUTPUT);
pinMode(pinButton, INPUT_PULLUP);
}
void loop() {
int btn = digitalRead(pinButton);
if (btn == HIGH) {
digitalWrite(pinLed, LOW);
}
else {
digitalWrite(pinLed, HIGH);
}
}
}
}
I will continue to work on the following problems.
I tried to do serial communication. I think I could upload a program to the board, but characters were not displayed.
#include
SoftwareSerial mySerial(0,1);
void setup() {
mySerial.begin(9600);
}
void loop() {
char a;
mySerial.println(a);
}
I usually use Windows(7 and 10). So I really want to use it to program. But when I upload a program on Windows, the following message displays.
avrdude: usbdev_open(): did not find any USB device "usb"
I think I have to install some drivers about FTDI or AVRDUDE...
When I press the button, the light turns off.