中野班 中野班
/
LCD課題6
Revision 0:fe3171c289a6, committed 2016-10-11
- Comitter:
- nakano_han
- Date:
- Tue Oct 11 05:57:30 2016 +0000
- Commit message:
- LCD??5
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Tue Oct 11 05:57:30 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/simon/code/TextLCD/#308d188a2d3a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Oct 11 05:57:30 2016 +0000 @@ -0,0 +1,76 @@ +#include "mbed.h" +#include "TextLCD.h" + +TextLCD lcd(D8,D10,D11,D12,D13,D14); // rs, e, d4, d5, d6, d7) //LCD出力設定 +AnalogIn sw1(A5); //SW入力設定 +AnalogIn sw2(A4); //SW入力設定 +DigitalOut out4(D4); //LED出力設定 +int main() +{ + int a = 0; //関数aを定義 + int y = 0; + + lcd.locate(a,y); //表示座標 + lcd.puts("@"); //文字表示 + + while(1) //無限ループ + { + if(sw1 == 1) //swが押されたら{}内実行 + { + if(a <= 16 && y == 0) + { + a++; + wait(0.5); + } + + if(a >= 0 && y == 1) + { + a--; + wait(0.5); + } + + if(y == 0 && a >= 16) + { + a = 15; + y = 1; + } + + if(y == 1 && a < 0) + { + a = 0; + y = 0; + } + lcd.cls(); + } + + if(sw2 == 1) + { + if(a <= 16 && y == 0) + { + a--; + wait(0.5); + } + + if(a >= 0 && y == 1) + { + a++; + wait(0.5); + } + + if(y == 0 && a < 0) + { + + a = 0; + y = 1; + } + if(y == 1 && a >= 16) + { + a = 15; + y = 0; + } + lcd.cls(); + } + lcd.locate(a,y); //表示座標 + lcd.puts("@"); //文字表示 + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Oct 11 05:57:30 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3 \ No newline at end of file