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:5c99971e3ee5, 2019-06-05 (annotated)
- Committer:
- tontoko
- Date:
- Wed Jun 05 13:37:04 2019 +0000
- Revision:
- 1:5c99971e3ee5
- Parent:
- 0:224a2b438db4
- Child:
- 2:d2d66ce72529
Ver.5.1
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| tontoko | 0:224a2b438db4 | 1 | #include "mbed.h" | 
| tontoko | 0:224a2b438db4 | 2 | #include "TextLCD.h" | 
| tontoko | 0:224a2b438db4 | 3 | |
| tontoko | 0:224a2b438db4 | 4 | #define LED_TIME 0.5 | 
| tontoko | 0:224a2b438db4 | 5 | |
| tontoko | 0:224a2b438db4 | 6 | DigitalOut myled(P0_22); | 
| tontoko | 0:224a2b438db4 | 7 | Serial pc(USBTX, USBRX); | 
| tontoko | 0:224a2b438db4 | 8 | |
| tontoko | 0:224a2b438db4 | 9 | TextLCD lcd(p15,p16,p17,p18,p19,p20); //接続ポートの設定(rs,e,d4,d5,d6,d7) | 
| tontoko | 0:224a2b438db4 | 10 | |
| tontoko | 0:224a2b438db4 | 11 | int main() | 
| tontoko | 0:224a2b438db4 | 12 | { | 
| tontoko | 0:224a2b438db4 | 13 | |
| tontoko | 0:224a2b438db4 | 14 | lcd.cls(); | 
| tontoko | 0:224a2b438db4 | 15 | lcd.locate(0,0); | 
| tontoko | 0:224a2b438db4 | 16 | // 01234567890123456 | 
| tontoko | 0:224a2b438db4 | 17 | //lcd.printf("ABCDEFGHIJKLMNO"); | 
| tontoko | 0:224a2b438db4 | 18 | lcd.printf("abcd"); | 
| tontoko | 0:224a2b438db4 | 19 | |
| tontoko | 0:224a2b438db4 | 20 | lcd.locate(0,1); | 
| tontoko | 0:224a2b438db4 | 21 | lcd.printf("abcdefghijklmnopqrstuvwxyz"); | 
| tontoko | 0:224a2b438db4 | 22 | |
| tontoko | 0:224a2b438db4 | 23 | lcd.home(); | 
| tontoko | 0:224a2b438db4 | 24 | lcd.printf("AB"); | 
| tontoko | 0:224a2b438db4 | 25 | |
| tontoko | 0:224a2b438db4 | 26 | wait(1); | 
| tontoko | 0:224a2b438db4 | 27 | lcd.noDisplay(); //ディスプレイ表示OFF | 
| tontoko | 0:224a2b438db4 | 28 | |
| tontoko | 0:224a2b438db4 | 29 | lcd.printf("CD");//表示OFFのままprint | 
| tontoko | 0:224a2b438db4 | 30 | |
| tontoko | 0:224a2b438db4 | 31 | wait(1); | 
| tontoko | 0:224a2b438db4 | 32 | lcd.display(); //ディスプレイ表示ON(OFFのままprintしても反映されている) | 
| tontoko | 0:224a2b438db4 | 33 | |
| tontoko | 0:224a2b438db4 | 34 | wait(1); | 
| tontoko | 0:224a2b438db4 | 35 | lcd.cursor(); //カーソル表示ON | 
| tontoko | 0:224a2b438db4 | 36 | |
| tontoko | 0:224a2b438db4 | 37 | lcd.blink(); //ブリンクON | 
| tontoko | 0:224a2b438db4 | 38 | |
| tontoko | 0:224a2b438db4 | 39 | wait(5); | 
| tontoko | 0:224a2b438db4 | 40 | |
| tontoko | 0:224a2b438db4 | 41 | lcd.noBlink(); //ブリンクOFF | 
| tontoko | 0:224a2b438db4 | 42 | |
| tontoko | 0:224a2b438db4 | 43 | lcd.noCursor(); //カーソル表示OFF | 
| tontoko | 0:224a2b438db4 | 44 | |
| tontoko | 0:224a2b438db4 | 45 | lcd.scrollDisplayLeft(); | 
| tontoko | 0:224a2b438db4 | 46 | wait(1); | 
| tontoko | 0:224a2b438db4 | 47 | lcd.scrollDisplayLeft(); | 
| tontoko | 0:224a2b438db4 | 48 | wait(1); | 
| tontoko | 0:224a2b438db4 | 49 | lcd.scrollDisplayLeft(); | 
| tontoko | 0:224a2b438db4 | 50 | wait(1); | 
| tontoko | 0:224a2b438db4 | 51 | lcd.scrollDisplayRight(); | 
| tontoko | 0:224a2b438db4 | 52 | wait(1); | 
| tontoko | 0:224a2b438db4 | 53 | lcd.scrollDisplayRight(); | 
| tontoko | 0:224a2b438db4 | 54 | wait(1); | 
| tontoko | 0:224a2b438db4 | 55 | lcd.scrollDisplayRight(); | 
| tontoko | 0:224a2b438db4 | 56 | wait(1); | 
| tontoko | 0:224a2b438db4 | 57 | lcd.cls(); | 
| tontoko | 0:224a2b438db4 | 58 | lcd.locate(10,0); | 
| tontoko | 1:5c99971e3ee5 | 59 | lcd.leftToRight(); | 
| tontoko | 0:224a2b438db4 | 60 | lcd.printf("01234"); | 
| tontoko | 0:224a2b438db4 | 61 | wait(1); | 
| tontoko | 0:224a2b438db4 | 62 | // lcd.locate(10,0); | 
| tontoko | 1:5c99971e3ee5 | 63 | // lcd.rightToLeft(); | 
| tontoko | 0:224a2b438db4 | 64 | // lcd.printf("56789"); | 
| tontoko | 0:224a2b438db4 | 65 | |
| tontoko | 0:224a2b438db4 | 66 | |
| tontoko | 0:224a2b438db4 | 67 | while(1) { | 
| tontoko | 0:224a2b438db4 | 68 | myled = 1; | 
| tontoko | 0:224a2b438db4 | 69 | wait(LED_TIME); | 
| tontoko | 0:224a2b438db4 | 70 | myled = 0; | 
| tontoko | 0:224a2b438db4 | 71 | wait(LED_TIME); | 
| tontoko | 0:224a2b438db4 | 72 | } | 
| tontoko | 0:224a2b438db4 | 73 | } | 
| tontoko | 0:224a2b438db4 | 74 | |
| tontoko | 0:224a2b438db4 | 75 |