本帖最后由 chudy87 于 2015-1-20 16:09 编辑
接到21iC客服电话说要个快递一块STM32F411 Nucleo板子,正好要做一个多组机器人的项目,这下STM32F411 Nucleo强大的Arduino功能可以用上了,真是高兴啊 呵呵!!
无语中,搞基了半天图片愣是传不上去,:L:curse:
拿到板子赶紧插上USB先体验一番,一插上去弹出来一个盘符“NUCLEO”瞬间一头雾水,有木有!!后来搞明白了原来写好的程序编译后生成的XX.BIN文件可以直接复制到此处啊,确实好用
上官网升级固件去喽。。。下载-安装-搞定!!
参考网上的mbed在线编程整出了一个LED小程序测试了一下,按动按键,LED灯开始以自己设定的不同频率开始闪烁了,挺不错的,呵呵!
主程序如下
#include "mbed.h"
DigitalIn mybutton(USER_BUTTON);
DigitalOut myled(LED1);
int main() {
int i=0;
while(1) {
if (mybutton == 0) { // Button is pressed
i++;}
myled = !myled; // Toggle the LED state
if(i==1)wait(0.005); // 200 ms
if(i==2)wait(0.1); // 200 ms
if(i==3)wait(0.5); // 200 ms
if(i==4)wait(1); // 200 ms
if(i==5)i=1; // 200 ms
}
}
来了兴趣挡都挡不住啊,再来个串口打印测试,呵呵!!下好程序,打开串口助手选择相应的串口号,看!!收到了
Welcome to Stm32-M4 !
This program runs since 1 seconds.
This program runs since 2 seconds.
This program runs since 3 seconds.
This program runs since 4 seconds.
This program runs since 5 seconds.
This program runs since 6 seconds.
This program runs since 7 seconds.
This program runs since 8 seconds.
This program runs since 9 seconds.
This program runs since 10 seconds.
This program runs since 11 seconds.
This program runs since 12 seconds.
This program runs since 13 seconds.
This program runs since 14 seconds.
This program runs since 15 seconds.
This program runs since 16 seconds.
This program runs since 17 seconds.
This program runs since 18 seconds.
This program runs since 19 seconds.
This program runs since 20 seconds.
This program runs since 21 seconds.
This program runs since 22 seconds.
This program runs since 23 seconds.
This program runs since 24 seconds.
把用mbed编写的主程序贴出来吧,看着是不是很简单!
下边就要好好地研究研究PWM了,开始为多足机器人控制做准备了
#include "mbed.h"
//------------------------------------
// Hyperterminal configuration
// 9600 bauds, 8-bit data, no parity
//------------------------------------
Serial pc(SERIAL_TX, SERIAL_RX);
DigitalOut myled(LED1);
int main() {
int i = 1;
pc.printf("Welcome to Stm32-M4 !\n");
while(1) {
wait(1);
pc.printf("This program runs since %d seconds.\n", i++);
myled = !myled;
}
}
满怀信心的打开了常用的keil软件,发现竟然没有 Stm32F411 ,失望中..........
于是下载新版 keil 5.13。。。。。。安装中。。。。好不容易弄好了 还是没有找到STm32F411REXX
继续努力中。。。。。。。为12路独立PWM奋斗:dizzy:
|