Digispark控制板使用

出自YFRobotwiki
跳轉到: 導覽搜尋

連接並使用digispark

Bootloader:

The bootloader is the code that is pre-programmed on your Digispark and allows it to act as a USB device so that it can be programmed by the Arduino IDE.

The Digispark runs the 「micronucleus tiny85」 bootloader version 1.02, an open source project: https://github.com/micronucleus/micronucleus originally written by Bluebie: https://github.com/Bluebie.

CAUTION We are not at this point supporting upgrading the firmware, so if you decide to, you do so entirely at your own risk.

Software:

The Digispark uses the Arduino IDE 1.6.5+ (Arduino 1.6.5r2 - NOT 1.6.6 or 1.6.7 strongly recommended)

安裝說明

windows install

打開設置


  • 在 Additional Boards Manager URLs 輸入框中填寫:http://digistump.com/package_digistump_index.json,點擊OK

設置鏈接


  • Tools -> Boad -> Boards Manager,type選擇 "Contributed",之後選擇"Digistump AVR Boards" 安裝包,點擊"Install"按鈕進行安裝

選擇板型管理器下載安裝


  • 等待下載安裝完成後,會顯示"Installed";完成後,Tools -> Boards ->Digispark(Default - 16.5mhz),新用戶建議選擇該項。

選擇板型


  • 安裝完成


Linux Install


下載程序測試

digispark 和其他arduino兼容產品不同,下面看看具體哪裡不同?

  • 板型選擇:Tools -> Boards -> Digispark(Default - 16.5mhz) (Tools -> Programmer無需選擇)
  • 打開常式代碼:File -> Examples -> Digispark_Examples -> Start (無需連接控制板),代碼如下:
// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(0, OUTPUT); //LED on Model B
  pinMode(1, OUTPUT); //LED on Model A   
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(0, HIGH);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(1, HIGH);
  delay(1000);               // wait for a second
  digitalWrite(0, LOW);    // turn the LED off by making the voltage LOW
  digitalWrite(1, LOW); 
  delay(1000);               // wait for a second
}
  • 點擊"Upload"按鈕,底部狀態欄會提示要求連接digispark控制板,這時你需要將其插入(你有60s的時間將其連接上,不用著急)

等待插入控制板


  • 插上Digispark控制板後,等待下載完成,底部狀態欄會有提示,如下圖:

完成下載


  • 程序下載完成後,它將立即運行代碼

blink


PS:如果你拔掉digispark並重新供電,程序將延時5秒運行。這5秒延時是確定你是否想要運行此程序。




返回首頁

更多建議和問題歡迎反饋至 YFRobot論壇

購買方式:YFRobot 電子工作室