Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@1:ca350ec7e01c, 2016-10-06 (annotated)
- Committer:
- nakano_han
- Date:
- Thu Oct 06 05:04:57 2016 +0000
- Revision:
- 1:ca350ec7e01c
- Parent:
- 0:c57745f04ba3
LED??2
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| nakano_han | 0:c57745f04ba3 | 1 | #include "mbed.h" |
| nakano_han | 0:c57745f04ba3 | 2 | |
| nakano_han | 1:ca350ec7e01c | 3 | AnalogIn sw1(A5); //SW1入力設定 |
| nakano_han | 1:ca350ec7e01c | 4 | AnalogIn sw2(A4); //SW2入力設定 |
| nakano_han | 1:ca350ec7e01c | 5 | BusOut leds(D7,D6,D5,D4); //LED出力設定 |
| nakano_han | 0:c57745f04ba3 | 6 | |
| nakano_han | 0:c57745f04ba3 | 7 | int main() |
| nakano_han | 0:c57745f04ba3 | 8 | { |
| nakano_han | 1:ca350ec7e01c | 9 | char x=0; //char型変数宣言 |
| nakano_han | 1:ca350ec7e01c | 10 | while(1){ //無限ループ |
| nakano_han | 1:ca350ec7e01c | 11 | for(x=0;x<=15;x++) //x初期値0,xが15以下の間繰り返す,1周ごとにxに1足す |
| nakano_han | 0:c57745f04ba3 | 12 | { |
| nakano_han | 1:ca350ec7e01c | 13 | leds = x; //ledをxの値と同じ数2進数で出力 |
| nakano_han | 1:ca350ec7e01c | 14 | wait(0.25); //0.25秒待つ |
| nakano_han | 0:c57745f04ba3 | 15 | } |
| nakano_han | 0:c57745f04ba3 | 16 | } |
| nakano_han | 0:c57745f04ba3 | 17 | } |