Objective
thank the Forum, thank Linksrite, forum activities applied for a linknode, experience a bit of mbed.
Read the official wiki, probably understand the development of the mbed, and then do the blink and PWM test, found mbed and familiar with the Arduino pole, and more powerful appearance, the online IDE is easy to use, the library reference is also with the use of, that is, the network response speed on the operation Some impact, experience will be slightly less, really want to use often, or more inclined to the local IDE more handy.
Test
So gossip don't say, try the official wiki on the Blink bar, the program skipped, Video:
And then upgrade blink, since there are two colors, red and blue, as blink as a police car lights the same effect bar, passing test serial port:
//a blink experiment with a flashing red and blue like a police car lamp.#include <mbed.h>digitalout Led_r (p0_20);D igitalout led_b (p0_19); Serial PC (p0_23, p0_25);intMain () { while(true) {Led_r=1; Led_b=0; Wait (0.5); Led_r=0; Led_b=1; Wait (0.5); pc.printf ("blink!\n"); } }
Video:
Then the PWM breathing light, directly to the two-color gradual breathing effect bar:
//PWM two x LED test#include<mbed.h>Serial PC (p0_23, p0_25); Pwmout Led_r (P0_20); Pwmout led_b (p0_19);floatDelta =0.05;floatDeltar =Delta;floatDeltab =0;intMain () {Led_r.write (0); Led_b.write (0); while(true) {Led_r= Led_r +Deltar; Led_b= Led_b +Deltab; Wait (0.02); if(Led_r.read () >=0.999) {Deltar= -Deltar; } Else if(Led_r.read () <=0.001) {Deltar=0; Deltab=Delta; Led_r=0.002; } if(Led_b.read () >=0.999) {Deltab= -Deltab; } Else if(Led_b.read () <=0.001) {Deltab=0; Deltar=Delta; Led_b=0.002; } pc.printf ("led_r:%f, Delta:%f, Led_b:%f, Delta:%f\n",float(Led_r), Deltar,float(led_b), deltab); }}
Video:
Reference documents
- Linknode Wik:http://linksprite.com/wiki/index.php5?title=mbed_ble_sensors_tag
- Linknode Official Document: Https://www.gitbook.com/book/yaoq/linknode/details
- mbed Online ide:https://www.mbed.com/zh-cn/
Mbed Preliminary Examination (Linknode Board) (2016-04-21)