Yuvraj Sune
/
mbed-os-example-blinky
Fully tested RGB leds
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2019 ARM Limited 00003 * SPDX-License-Identifier: Apache-2.0 00004 */ 00005 00006 #include "mbed.h" 00007 #include "platform/mbed_thread.h" 00008 00009 00010 // Blinking rate in milliseconds 00011 #define BLINKING_RATE_MS 1000 00012 00013 00014 int main() 00015 { 00016 // Initialise the digital pin LED1 as an output 00017 DigitalOut led2(LED3); 00018 DigitalOut led1(LED2); 00019 DigitalOut led(LED1); 00020 00021 while (true) { 00022 led = !led; 00023 thread_sleep_for(BLINKING_RATE_MS); 00024 led1 =!led1; 00025 thread_sleep_for(BLINKING_RATE_MS); 00026 led2 =!led2; 00027 thread_sleep_for(BLINKING_RATE_MS); 00028 } 00029 }
Generated on Thu Jul 21 2022 20:51:12 by 1.7.2