Mbed Preliminary Examination (Linknode Board) (2016-04-21)

Source: Internet
Author: User

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

    1. Linknode Wik:http://linksprite.com/wiki/index.php5?title=mbed_ble_sensors_tag
    2. Linknode Official Document: Https://www.gitbook.com/book/yaoq/linknode/details
    3. mbed Online ide:https://www.mbed.com/zh-cn/

Mbed Preliminary Examination (Linknode Board) (2016-04-21)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.