test
Dependencies: NokiaLCD_6100_o mbed
main.cpp@0:7797ffbe95fe, 2017-04-19 (annotated)
- Committer:
- SES01
- Date:
- Wed Apr 19 08:19:26 2017 +0000
- Revision:
- 0:7797ffbe95fe
????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
SES01 | 0:7797ffbe95fe | 1 | #include "mbed.h" |
SES01 | 0:7797ffbe95fe | 2 | #include "NokiaLCD.h" |
SES01 | 0:7797ffbe95fe | 3 | |
SES01 | 0:7797ffbe95fe | 4 | NokiaLCD lcd(p5, p7, p8, p9, NokiaLCD::PCF8833); // mosi, sclk, cs, rst, type |
SES01 | 0:7797ffbe95fe | 5 | // 橙 白 緑 紫 |
SES01 | 0:7797ffbe95fe | 6 | int main() { |
SES01 | 0:7797ffbe95fe | 7 | int bgcolor=0; |
SES01 | 0:7797ffbe95fe | 8 | lcd.background(0x0000FF); |
SES01 | 0:7797ffbe95fe | 9 | while(1){ |
SES01 | 0:7797ffbe95fe | 10 | |
SES01 | 0:7797ffbe95fe | 11 | switch(bgcolor++) |
SES01 | 0:7797ffbe95fe | 12 | { |
SES01 | 0:7797ffbe95fe | 13 | case 0 :lcd.background(0x800000); break; |
SES01 | 0:7797ffbe95fe | 14 | case 1 :lcd.background(0x008000); break; |
SES01 | 0:7797ffbe95fe | 15 | case 2 :lcd.background(0x000080); bgcolor=0; break; |
SES01 | 0:7797ffbe95fe | 16 | } |
SES01 | 0:7797ffbe95fe | 17 | |
SES01 | 0:7797ffbe95fe | 18 | lcd.cls(); |
SES01 | 0:7797ffbe95fe | 19 | lcd.fill(1, 20, 128, 10, 0x00ff00); // 緑 |
SES01 | 0:7797ffbe95fe | 20 | lcd.fill(0, 70, 130, 10, 0x0000ff); // 青 |
SES01 | 0:7797ffbe95fe | 21 | lcd.fill(50, 1, 10, 128, 0xFF0000); // 赤 |
SES01 | 0:7797ffbe95fe | 22 | for(int i=0; i<3; i++) { |
SES01 | 0:7797ffbe95fe | 23 | lcd.locate(0,i+12); |
SES01 | 0:7797ffbe95fe | 24 | lcd.printf("Hello World!miz%d", i); |
SES01 | 0:7797ffbe95fe | 25 | } |
SES01 | 0:7797ffbe95fe | 26 | for (int i=0; i<130; i++) { |
SES01 | 0:7797ffbe95fe | 27 | lcd.pixel(i, 60 + sin((float)i / 5.0)*10, 0xffffff); |
SES01 | 0:7797ffbe95fe | 28 | } |
SES01 | 0:7797ffbe95fe | 29 | wait_us(33333); |
SES01 | 0:7797ffbe95fe | 30 | } |
SES01 | 0:7797ffbe95fe | 31 | } |