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.
Revision 0:1b0ed30bc403, committed 2014-05-08
- Comitter:
- tim008
- Date:
- Thu May 08 12:46:12 2014 +0000
- Commit message:
- LV8_Grupa5_Tim008_Zad1
Changed in this revision
diff -r 000000000000 -r 1b0ed30bc403 TSI.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TSI.lib Thu May 08 12:46:12 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/vsluiter/code/TSI/#4dc2f5a3a731
diff -r 000000000000 -r 1b0ed30bc403 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu May 08 12:46:12 2014 +0000 @@ -0,0 +1,99 @@ +#include "mbed.h" +#include "TSISensor.h" +PwmOut crvena(LED1); +PwmOut zelena (LED2); +PwmOut plava (LED3); +Ticker tikercic; + +Serial pc( USBTX,USBRX); +TSISensor tsi; +int osvjetljenost1; +int osvjetljenost2; +int osvjetljenost3; + +int crvenaje=0; +int zelenaje=0; +int plavaje=0; +char uneseno; + + +int broj1; +int broj2; + +int senzorcic=0; + +int cifre=0; + +void Senzor() +{ + if(senzorcic==1) + { + pc.printf("%f",tsi.readPercentage()); //printf stavlja integer i float moze i char, dok putc stavlja samo char a puts samo string + } +} +int main() { + + tikercic.attach(Senzor,1); + while(1) { + + uneseno=pc.getc(); + if(uneseno=='R') crvenaje=1; + else if(uneseno=='G')zelenaje=1; + else if(uneseno=='B')plavaje=1; + else if(uneseno=='P')senzorcic=1; + else if(uneseno=='Z')senzorcic=0; + + // vidi da li cita jedno po jedno il odmah moze sve tri procitat// + if(crvenaje==1 || plavaje==1|| zelenaje==1) + { + + uneseno=pc.getc(); + + if(uneseno>='0' && uneseno<='9') + { + cifre++; + if(cifre%2!=0)broj1=(uneseno-'0')*10; + else broj2=uneseno-'0'; + + + uneseno=pc.getc(); + + if(uneseno>='0' && uneseno<='9') + { + cifre++; + if(cifre%2!=0)broj1=(uneseno-'0')*10; + else broj2=uneseno-'0'; + } + if(cifre%2==0) + { + if(crvenaje==1) + { + plava=zelena=1; + crvena=1.0-((broj1+broj2)/100.); + // crvena=0.0; + crvenaje=0; + } + if(plavaje==1) + { + crvena=zelena=1; + plava=1.0-((broj1+broj2)/100.); + //plava=0.0; + plavaje=0; + } + if(zelenaje==1) + { + plava=crvena=1; + zelena=1.0-((broj1+broj2)/100.); + //zelena=0.0; + zelenaje=0; + + } + } + } + } + + + + + } +}
diff -r 000000000000 -r 1b0ed30bc403 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu May 08 12:46:12 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776 \ No newline at end of file