wiki:rock/note/arduino

Version 5 (modified by rock, 14 years ago) (diff)

--

1.環境

  • OS - Ubuntu 9.10 Desktop (32bit)
  • gcc-avr - 1:4.3.3-1


2.安裝開發工具於 Ubuntu

  • 安裝
    $ sudo aptitude install binutils-avr avrdude gcc-avr
    
  • 安裝 Arduino IDE
    $ wget http://arduino.googlecode.com/files/arduino-0017.tgz
    $ tar zxvf arduino-0017.tgz
    $ cd arduino-0017
    $ ./arduino
    


3.Hello World

  • 先透過 USB 連接到電腦,若是有抓到 arduino 板子的話,可以看到 PWR 燈和 L 燈會亮起來
  • 開啟 Arduino IDE,設定連接埠

  • HelloWorld 範例程式
    • 選取範例檔 (如下圖)

  • 編譯,按下 Verify 按鈕,若出現 「done compiling」表示編譯完成

  • 燒錄至 Arduino 版子

  • 察看 Console


4.控制燈號

  • 讓 L 燈亮5秒 接著 熄滅1秒
    #define LED 13
    void setup()
    {
    }
    
    void loop()
    {
      digitalWrite(LED, HIGH);
      delay(5000);
      digitalWrite(LED, LOW);
      delay(1000);
    }
    

Attachments (8)

Download all attachments as: .zip