Lee Nam Cheol
/
lab05-app-shield-rgb-led
main.cpp
- Committer:
- namcheol
- Date:
- 2020-05-12
- Revision:
- 2:85664e80d85a
- Parent:
- 1:fd97c8defb39
File content as of revision 2:85664e80d85a:
#include "mbed.h" #include "C12832.h" C12832 lcd(D11, D13, D12, D7, D10); //lcd = (MOSI, SCK, RESET, A0, nCS) PwmOut led_r(D5); PwmOut led_g(D9); PwmOut led_b(D8); int main() { lcd.cls(); //clear screen lcd.locate(0, 6); lcd.printf("RGB LED!!"); while(true) { for(float f = 0.0; f < 1.0; f += 0.05) { led_r = 1.0 - f; led_g = 1.0; led_b = 1.0; lcd.locate(0, 16); lcd.printf("Red=%.2f, Green=%.2f, Blue=%.2f", f, 0.0, 0.0); thread_sleep_for(10); } for(float f = 0.0; f < 1.0; f += 0.05) { led_r = 1.0; led_g = 1.0 - f; led_b = 1.0; lcd.locate(0, 16); lcd.printf("Red=%.2f, Green=%.2f, Blue=%.2f", 0.0, f, 0.0); thread_sleep_for(10); } for(float f = 0.0; f < 1.0; f += 0.05) { led_r = 1.0; led_g = 1.0; led_b = 1.0 - f; lcd.locate(0, 16); lcd.printf("Red=%.2f, Green=%.2f, Blue=%.2f", 0.0, 0.0, f); thread_sleep_for(10); } } }