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 fistrek_intenzitetdiode by
Revision 1:b705e18b90e7, committed 2015-12-10
- Comitter:
- ffistrek
- Date:
- Thu Dec 10 14:39:20 2015 +0000
- Parent:
- 0:48d70c5c168b
- Child:
- 2:913f33d69e70
- Commit message:
- Vjezba_3.4.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Dec 03 18:07:54 2015 +0000
+++ b/main.cpp Thu Dec 10 14:39:20 2015 +0000
@@ -1,49 +1,21 @@
#include "mbed.h"
-Serial pc(USBTX, USBRX);
-AnalogIn Ain(p20);
-
-DigitalOut led1(LED1);
-DigitalOut led2(LED2);
-DigitalOut led3(LED3);
-DigitalOut led4(LED4);
-
-float ADCdata;
-
-int main() {
-pc.printf("ADC Data Values... \n\r");
-while (1) {
-ADCdata=Ain;
-pc.printf("%f \n\r",ADCdata);
-if(Ain <=0.2){
-led1=0;
-led2=0;
-led3=0;
-led4=0;
-}
-if((Ain>0.2)&&(Ain<=0.4)){
-led1=1;
-led2=0;
-led3=0;
-led4=0;
-}
-if((Ain>0.4)&&(Ain<=0.6)){
-led1=1;
-led2=1;
-led3=0;
-led4=0;
-}
-if((Ain>0.6)&&(Ain<=0.8)){
-led1=1;
-led2=1;
-led3=1;
-led4=0;
-}
-if((Ain>0.8)&&(Ain<=1.0)){
-led1=1;
-led2=1;
-led3=1;
-led4=1;
-}
-
-}
-}
\ No newline at end of file
+ int main() {
+ DigitalOut myled(LED1);
+ DigitalIn sw(p5);
+ sw.mode(PullUp);
+ float ts=0.5;
+
+ while(1)
+ {
+ myled = 1;
+ wait(ts);
+ myled = 0;
+ wait(ts);
+ if (sw==1)
+ {
+ ts=ts/2.0;
+ }
+
+ }
+
+ }
\ No newline at end of file
