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
Revision 1:047b95725b95, committed 2017-12-11
- Comitter:
- ataphon21938
- Date:
- Mon Dec 11 09:16:48 2017 +0000
- Parent:
- 0:6e7a6e71dad3
- Commit message:
- 11/12/2560
Changed in this revision
| ColorMbed.cpp | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/ColorMbed.cpp Sat Dec 03 10:17:37 2016 +0000
+++ b/ColorMbed.cpp Mon Dec 11 09:16:48 2017 +0000
@@ -4,7 +4,7 @@
SPI dot_matrix(D11,NC,D13); //mosi miso sclk
DigitalOut lat(PA_12);
DigitalOut sb(PA_11);
-DigitalOut rst(D10);
+DigitalOut rst(PB_12);
BusOut open_line(D2,D3,D4,D5,D6,D7,D8,D9);
//c0 c1 c2 c3 c4 c5 c6 c7 dont foget d7
uint8_t temp;
@@ -50,9 +50,9 @@
lat = 1;
lat = 0;
open_line = line[row];
- wait(0.6);
+
open_line = 0;
- wait(0.4);
+
//}
}
--- a/main.cpp Sat Dec 03 10:17:37 2016 +0000
+++ b/main.cpp Mon Dec 11 09:16:48 2017 +0000
@@ -5,23 +5,70 @@
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 rgb[3] = {10,20,0};
- uint8_t pic[8] = {0x1C,0x00,0x20,0x20,0x20,0x20,0x00,0x00};
- uint8_t pic2[8] = {0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
- uint8_t dream_ship[8] = {0x40,0x50,0x41,0x4E,0x00,0x92,0x14,0x04};
- // for coordinate
- //uint8_t pic2[8] = {0x7E,0xDF,0xFF,0xF0,0xFF,0x7E,0x3C,0x3C};
- //uint8_t tmp_pic[8] = {0};
- dotmatrix.init();
- while(1){
- dotmatrix.display_pic(dream_ship,rgb);
- }
-
- return 0;
+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);
+}}
+
