LGT8F328 UNO R3编译上传
示例代码
这是一段示例代码,将示例代码编译打包上传到LGT8F328 UNO R3开发板。
#include <Servo.h>
Servo myservo;
int pos = 0;
void setup() {// put your setup code here, to run once:Serial.begin(9600);Serial.println("start");myservo.attach(11,500,2500);
}void loop() {// put your main code here, to run repeatedly:for(pos = 0;pos<=180;pos+=5){myservo.write(pos);Serial.println(pos);delay(22);}for(pos = 180;pos>=0;pos-=5){myservo.write(pos);Serial.println(pos);delay(22);}
}
添加开发板
首先要添加一个开发板,在arduino ide的菜单》文件》首选项》其他开发板地址,添加:http://cdn.vue-os.com/package_nulllab_boards_index_zh.json
这是源仓库的配置,我搬运了一个到我的服务器上。
我这克隆的仓库地址:https://gitee.com/piaoyizhe666666/nulllab_arduino.git
仓库源地址:https://github.com/nulllaborg/arduino_nulllab.git
编译上传
上传配置:
开发板=》DIY Board
CPU Frequency=》16 MHz
Clock Source=》Internal (32MHz)
EEROM Size=》OKB
Upload speed=》57600
Variant=》LGT328P-LQFP48
编程器=》Arduino/Nulllab as ISP(LGT8F328P)
我这样顺利上传了,不用完全一样,有些项可以按情况修改。