来自:https://learn.adafruit.com/use-micro-bit-with-arduino
仅翻译前言部分:
你知道吗, Arduino IDE 可以用来编程Microbit?现在你还有另一种方式来使用这个酷板!了解如何设置 Arduino 编程您的Microbit, 闪烁一些 led, 阅读内部温度传感器, 通过蓝牙发送和接收数据-甚至日志数据到 Adafruit。
Microbit是一个给孩子用的小 nRF51-powered 学习平台-你可以在微软 MakeCode (拖放 积木块编程或 Javascript), micropython, 或 mbed中使用它。但我们真的很喜欢使用 Arduino IDE, 特别是因为有数以千计的现有项目, 你可以使用和适应。此外, 你可以有更多的先进的项目, 因为你不会耗尽内存 (正如你在用的 micropython), 你能写任何你想要的代码 (用 MakeCode 更限制了什么已经为你提供的, 一个易用性的权衡)。
拿起一个 microbit, 并遵循如何你可以做一些非常先进的事情!
代码: 全选
const int COL1 = 3; // Column #1 control
const int LED = 26; // 'row 1' led
void setup() {
Serial.begin(9600);
Serial.println("microbit is ready!");
// because the LEDs are multiplexed, we must ground the opposite side of the LED
pinMode(COL1, OUTPUT);
digitalWrite(COL1, LOW);
pinMode(LED, OUTPUT);
}
void loop(){
Serial.println("blink!");
digitalWrite(LED, HIGH);
delay(500);
digitalWrite(LED, LOW);
delay(500);
}