第一个Arduino程序
首先準備好arduino硬件.本例子采用的是arduino兼容的DFRobot產品。
把硬件通過usb接入計算機后會自動安裝驅動。
從www.arduino.cc下載Arduino IDE,并安裝。
通過“工具”菜單配置開發板信息和串口通訊信息。
編寫測試程序
// the setup function runs once when you press reset or power the board
void setup() {
? // initialize digital pin 13 as an output.
? pinMode(7, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
? digitalWrite(7, HIGH); ? // turn the LED on (HIGH is the voltage level)
? delay(1000); ? ? ? ? ? ? ?// wait for a second
? digitalWrite(7, LOW); ? ?// turn the LED off by making the voltage LOW
? delay(1000); ? ? ? ? ? ? ?// wait for a second
}
編譯程序并上傳, 最后運行效果如下
總結
以上是生活随笔為你收集整理的第一个Arduino程序的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 基于Android NDK的交叉编译
- 下一篇: 通过libusb操作usb设备扫描二维码