![](/media/cache/profiles/5f14615696649541a025d3d0f8e0447f.jpg.50x50_q85.jpg)
ワークショップ用に公開しているものです。
Fork of Arch_Analog_Thermistor_Blinker by
Diff: main.cpp
- Revision:
- 3:a72374052938
- Parent:
- 2:d7639bb949d7
- Child:
- 4:ba523da0d68a
--- a/main.cpp Sun Sep 08 14:58:41 2013 +0000 +++ b/main.cpp Mon Sep 16 04:44:20 2013 +0000 @@ -1,15 +1,11 @@ #include "mbed.h" -/* Configure a GPIO pin as output for controlling a LED. 'led' is an user assigned name and - 'LED1' is an internal name given to a port pin P1_8 in this Arch platform. */ -DigitalOut led(LED1); +DigitalOut led(LED1); // Configure LED1 pin as output +DigitalIn button(P1_14); // Configure P1_14 pin as input int main() { while(1) { - led.write(1); // Here, DigitalOut -> write() function is used to set the ouput high. - wait_ms(500); // Wait for 0.5 Seconds. The time is specified in milli-seconds using wait_ms() function. - led.write(0); // Switch OFF the LED. - wait_us(500000); // Wait for 0.5 Seconds. The time is specified in micro-seconds using wait_us() function. + led.write(button.read()); /* read the state of input port pin P1_14 and write it to output port pin LED1*/ } }