[WEEK08]Embedded Programming

1.Read datasheet of ATtiny

What I learnt

2. Program my board

2.1 Set to use ATtiny with Arduino IDE

AT first, I set the environment to use ATtiny with Arduino IDE.

[File]→[Preference]→[Additional Boards Manager URLs]

I entered the following URL.


[Tools]→[Board]→[Board Manager]

Install "attiny by David A.Mellis" library.


Select a board type and programmer.

Clock:External 20 MHz
Programmer:AVRISP mk2

2.2 Burn bootloader

I connected my board with AVRISP mk2 and USB to serial converter, and then burned bootloader with Arduino IDE.

[Tools]→[Burn Bootloader]

2.3 Check a data sheet

Before writing a program, I checked a data sheet of ATtiny24A/44A/84A to know the pin numbers that connected to each compornent.

2.4 Program the board

I wrote a program that the LED shines only when I press the button.


     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);





testLed.ino: Download the file

3. What I could not do

I will continue to work on the following problems.

3.1 Serial communication

I tried to do serial communication. I think I could upload a program to the board, but characters were not displayed.

     SoftwareSerial mySerial(0,1);

     void setup() {

     void loop() {
         char a;

3.2 Program on Windows

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...

!!4. Additional comment after feedback!!

I tried to program with Fab ISP that I made. When using Mac, I was able to program,as well as when using AVRISP mk2. But, when using any windows PCs(laptop and desktop), I coudn't do and fix it.
My main PC is windows laptop. To use Mac, I have to start up my home desktop Mac or use a shared desktop Mac in my lab. It isn't convenient for me.
For that reason, after I confirmed that Fab ISP was doing well, I used AVR ISP mk2 to write even when I can use Mac.
As written in the paragraph above, in this time I couldn't write from windows even with AVR ISP mk2. But I could do it later.Probably because I installed the FTDI driver.


When I press the button, the light turns off.


testLed_reverse.ino: Download the file