Demirović Tarik Đenašević Emir

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 DigitalOut on(dp14);
00004 BusOut myleds (dp23, dp24, dp25, dp26, dp27, dp5, dp6, dp28);
00005 PwmOut led1(dp24);
00006 AnalogIn ain(dp9);
00007 
00008 float max=1.8;
00009 float min=0.6;
00010 
00011 int i=0;
00012 
00013 int main() {
00014     float srednja=max-min;
00015     float input=ain*3.3;
00016     float e=ain;
00017     float ratio=((e*3.3)-min)/srednja;
00018     on=0;
00019     myleds = 2;
00020     while(1) {
00021         if(i%200==0)
00022         {
00023             if(input>=min && input<=max)
00024             ratio=((e*3.3)-min)/srednja;
00025            i=1;
00026         }
00027         i++;
00028         led1=ratio;
00029     }
00030 }