MATSU-bed + I2CLCD sample (e.g. AQM0802A)
Dependencies: mbed I2cLCD MATSUbed USBDevice
Fork of MASTU-bed_I2CLCD by
AQM0802A: http://akizukidenshi.com/catalog/g/gP-06669/
main.cpp@0:430362be0583, 2018-05-13 (annotated)
- Committer:
- Tiryoh
- Date:
- Sun May 13 11:14:06 2018 +0000
- Revision:
- 0:430362be0583
- Child:
- 1:ac8ac251e0c3
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Tiryoh | 0:430362be0583 | 1 | #include "mbed.h" |
Tiryoh | 0:430362be0583 | 2 | #include "USBSerial.h" |
Tiryoh | 0:430362be0583 | 3 | #include "I2cLCD.h" |
Tiryoh | 0:430362be0583 | 4 | |
Tiryoh | 0:430362be0583 | 5 | #define LED1 P0_29 |
Tiryoh | 0:430362be0583 | 6 | #define LED2 P0_28 |
Tiryoh | 0:430362be0583 | 7 | #define LED3 P0_27 |
Tiryoh | 0:430362be0583 | 8 | #define LED4 P0_26 |
Tiryoh | 0:430362be0583 | 9 | |
Tiryoh | 0:430362be0583 | 10 | #define ISP0 P0_4 |
Tiryoh | 0:430362be0583 | 11 | #define ISP1 P0_16 |
Tiryoh | 0:430362be0583 | 12 | |
Tiryoh | 0:430362be0583 | 13 | USBSerial pc; |
Tiryoh | 0:430362be0583 | 14 | BusOut myled(LED1, LED2, LED3, LED4); |
Tiryoh | 0:430362be0583 | 15 | |
Tiryoh | 0:430362be0583 | 16 | I2cLCD lcd(P0_23, P0_22, P0_20); //sda, scl, reset |
Tiryoh | 0:430362be0583 | 17 | |
Tiryoh | 0:430362be0583 | 18 | int main() { |
Tiryoh | 0:430362be0583 | 19 | int timei = 0; |
Tiryoh | 0:430362be0583 | 20 | myled = 0b0000; |
Tiryoh | 0:430362be0583 | 21 | //while(pc.readable() == 0); |
Tiryoh | 0:430362be0583 | 22 | //pc.printf("KEY DETECTED!!\r\nPROGRAM START\r\n"); |
Tiryoh | 0:430362be0583 | 23 | while(1){ |
Tiryoh | 0:430362be0583 | 24 | pc.printf("program running...\r\n"); |
Tiryoh | 0:430362be0583 | 25 | myled = 0b0001; |
Tiryoh | 0:430362be0583 | 26 | wait(0.1); |
Tiryoh | 0:430362be0583 | 27 | |
Tiryoh | 0:430362be0583 | 28 | lcd.cls(); |
Tiryoh | 0:430362be0583 | 29 | lcd.printf(" %d",timei); |
Tiryoh | 0:430362be0583 | 30 | timei++; |
Tiryoh | 0:430362be0583 | 31 | if(timei>500)timei = 0; |
Tiryoh | 0:430362be0583 | 32 | |
Tiryoh | 0:430362be0583 | 33 | |
Tiryoh | 0:430362be0583 | 34 | myled = 0b0000; |
Tiryoh | 0:430362be0583 | 35 | wait(0.1); |
Tiryoh | 0:430362be0583 | 36 | } |
Tiryoh | 0:430362be0583 | 37 | } |