2 Star 1 Fork 2

_ashow_ / mbedStm32f103rc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.cpp 672 Bytes
一键复制 编辑 原始数据 按行查看 历史
方块八 提交于 2016-05-22 10:41 . 整理测试代码
#include "mbed.h"
DigitalOut myled(PA_8);
DigitalOut myLed2(PD_2);
Serial debugSerial(PA_9, PA_10);//tx, rx
int totalCnt = 0;
//串口中断处理函数
void handleSerialRx(){
if(debugSerial.readable()){
totalCnt++;
}
}
int main() {
//设置波特率
debugSerial.baud(115200);
debugSerial.printf("hello\r\n");
//注册中断处理函数
debugSerial.attach(handleSerialRx);
while(1) {
debugSerial.printf("totalCnt = %d\r\n",totalCnt);
myLed2 = 0;
myled = 1; // LED is ON
wait(1); // 200 ms
myLed2 = 1;
myled = 0; // LED is OFF
wait(1); // 1 sec
}
}
C
1
https://gitee.com/ashowSoft/mbedStm32f103rc.git
git@gitee.com:ashowSoft/mbedStm32f103rc.git
ashowSoft
mbedStm32f103rc
mbedStm32f103rc
master

搜索帮助