johan yapson
/
Nucleo_blink_led
first edition
main.cpp@0:582b91be6159, 2017-02-27 (annotated)
- Committer:
- johanyapson
- Date:
- Mon Feb 27 09:39:49 2017 +0000
- Revision:
- 0:582b91be6159
first edition
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
johanyapson | 0:582b91be6159 | 1 | #include "mbed.h" |
johanyapson | 0:582b91be6159 | 2 | |
johanyapson | 0:582b91be6159 | 3 | DigitalIn input(D2); |
johanyapson | 0:582b91be6159 | 4 | Serial pc(SERIAL_TX, SERIAL_RX); |
johanyapson | 0:582b91be6159 | 5 | |
johanyapson | 0:582b91be6159 | 6 | int i ; |
johanyapson | 0:582b91be6159 | 7 | int hitung = 0; |
johanyapson | 0:582b91be6159 | 8 | |
johanyapson | 0:582b91be6159 | 9 | int main() { |
johanyapson | 0:582b91be6159 | 10 | pc.baud(115200); |
johanyapson | 0:582b91be6159 | 11 | while(1) { |
johanyapson | 0:582b91be6159 | 12 | |
johanyapson | 0:582b91be6159 | 13 | if (D2 == 1) |
johanyapson | 0:582b91be6159 | 14 | { |
johanyapson | 0:582b91be6159 | 15 | i++; |
johanyapson | 0:582b91be6159 | 16 | } |
johanyapson | 0:582b91be6159 | 17 | |
johanyapson | 0:582b91be6159 | 18 | hitung = i; |
johanyapson | 0:582b91be6159 | 19 | pc.printf("barang = %d ",hitung); |
johanyapson | 0:582b91be6159 | 20 | wait(1.0); |
johanyapson | 0:582b91be6159 | 21 | } |
johanyapson | 0:582b91be6159 | 22 | } |