Digispark控制板使用

来自YFRobotwiki
2016年11月14日 (一) 16:20Admin讨论 | 贡献的版本

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航搜索

连接并使用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

打开设置


  • 在 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控制板,这时你需要将其插入
  • 下载完成后,底部状态栏提示,如下图:
  • 下载完成后,它将立即运行代码

PS:如果你拔掉digispark并重新供电,程序将延时5秒运行。这5秒延时是确定你是否想要运行此程序。