LCD表示
Dependencies: TextLCD
main.cpp@1:09d88b240733, 2020-07-13 (annotated)
- Committer:
- nishimura_taku_pet
- Date:
- Mon Jul 13 01:29:33 2020 +0000
- Revision:
- 1:09d88b240733
- Parent:
- 0:d9705f7c45dc
commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nishimura_taku_pet | 0:d9705f7c45dc | 1 | /* mbed Microcontroller Library |
nishimura_taku_pet | 0:d9705f7c45dc | 2 | * Copyright (c) 2019 ARM Limited |
nishimura_taku_pet | 0:d9705f7c45dc | 3 | * SPDX-License-Identifier: Apache-2.0 |
nishimura_taku_pet | 0:d9705f7c45dc | 4 | */ |
nishimura_taku_pet | 0:d9705f7c45dc | 5 | |
nishimura_taku_pet | 0:d9705f7c45dc | 6 | #include "mbed.h" |
nishimura_taku_pet | 0:d9705f7c45dc | 7 | //#include "platform/mbed_thread.h" |
nishimura_taku_pet | 0:d9705f7c45dc | 8 | #include "TextLCD.h" |
nishimura_taku_pet | 0:d9705f7c45dc | 9 | |
nishimura_taku_pet | 0:d9705f7c45dc | 10 | // Blinking rate in milliseconds |
nishimura_taku_pet | 0:d9705f7c45dc | 11 | #define BLINKING_RATE_MS 5 |
nishimura_taku_pet | 0:d9705f7c45dc | 12 | I2C i2c_lcd(p28, p27); |
nishimura_taku_pet | 0:d9705f7c45dc | 13 | TextLCD_I2C lcd(&i2c_lcd, (0x26 << 1), TextLCD::LCD16x2, TextLCD::HD44780); |
nishimura_taku_pet | 0:d9705f7c45dc | 14 | int main() |
nishimura_taku_pet | 0:d9705f7c45dc | 15 | { |
nishimura_taku_pet | 0:d9705f7c45dc | 16 | i2c_lcd.frequency(500); |
nishimura_taku_pet | 0:d9705f7c45dc | 17 | lcd.setBacklight(TextLCD::LightOn); |
nishimura_taku_pet | 0:d9705f7c45dc | 18 | while (true) { |
nishimura_taku_pet | 0:d9705f7c45dc | 19 | lcd.locate(0,0); |
nishimura_taku_pet | 0:d9705f7c45dc | 20 | lcd.printf("HELLO MBED!!!"); |
nishimura_taku_pet | 0:d9705f7c45dc | 21 | thread_sleep_for(BLINKING_RATE_MS); |
nishimura_taku_pet | 0:d9705f7c45dc | 22 | } |
nishimura_taku_pet | 0:d9705f7c45dc | 23 | } |