Lee Nam Cheol
/
lab01-led-with-switch
lab01-led-with-switch
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 00008 DigitalIn sw(D1, PullDown); //sw = D1(PullDown) 00009 DigitalOut led(D0); 00010 00011 int main() 00012 { 00013 while (true) { 00014 if(sw == 1){ 00015 led = 1; //led on 00016 thread_sleep_for(200); 00017 led = 0; //led off 00018 thread_sleep_for(200); 00019 led = 1; 00020 thread_sleep_for(200); 00021 led = 0; 00022 } 00023 } 00024 }
Generated on Sat Jul 30 2022 18:30:53 by 1.7.2