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.
Dependencies: mbed
Fork of ColorMbed by
main.cpp
- Committer:
- ataphon21938
- Date:
- 2017-12-11
- Revision:
- 1:047b95725b95
- Parent:
- 0:6e7a6e71dad3
File content as of revision 1:047b95725b95:
/***************** For test only ****************/ #include "mbed.h" #include "ColorMbed.h" ColorMbed dotmatrix; Timer t; Serial pc(D1,D0); AnalogIn ldr(A1); PwmOut led2(D2); PwmOut led3(D3); PwmOut led4(D4); PwmOut led5(D5); PwmOut led6(D6); PwmOut led7(D7); PwmOut led8(D8); PwmOut led9(D9); float tempo = 0.44; float value; float newvalue; float max; int main(){ // uint8_t rgb[3] = {255,255,100}; uint8_t rgb2[3] = {0,255,200}; //yellow uint8_t rgb1[3] = {0,255,0}; //green uint8_t rgb3[3] = {0,0,255}; //red uint8_t pic1[8] = {0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; uint8_t pic8[8] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; dotmatrix.init(); t.start(); float time; int STATE_endRecord = 0; while(1){ value = ldr.read(); newvalue = value*33/10; pc.printf("value is %.2f\n",value); led2.period(1.0/10000); //led2.write(0.1); led3.period(1.0/10000); //led3.write(0.1); led4.period(1.0/10000); //led4.write(0.1); led5.period(1.0/10000); //led5.write(0.1); led6.period(1.0/10000); //led6.write(0.1); led7.period(1.0/10000); //led7.write(0.1); led8.period(1.0/10000); //led8.write(0.1); led9.period(1.0/10000); //led9.write(0.1); max = 1-value; led2= 1-value; led3= 1-value; led4= 1-value; led5= 1-value; led6= 1-value; led7= 1-value; led8= 1-value; led9= 1-value; pc.printf("***value is %.2f\n",max); dotmatrix.display_pic(pic8,rgb3); wait(0.1); //dotmatrix.display_dot(5,5,rgb3); }}