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 3:6536ed4d073e, committed 2021-04-08
- Comitter:
- nikolarp
- Date:
- Thu Apr 08 12:25:44 2021 +0000
- Parent:
- 2:49f00e7e7913
- Commit message:
- .
Changed in this revision
| IO.h | 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/IO.h Mon Apr 05 17:52:54 2021 +0000
+++ b/IO.h Thu Apr 08 12:25:44 2021 +0000
@@ -4,7 +4,7 @@
DigitalOut zelena(D7);
DigitalOut Alarm(D3);
AnalogIn Ain(D11);
-InterruptIn button(PC_13);
+InterruptIn button(PC_13); //kreira funkcija InteruptIn povezanu na navedeni priključak
void LED(){
}
\ No newline at end of file
--- a/main.cpp Mon Apr 05 17:52:54 2021 +0000
+++ b/main.cpp Thu Apr 08 12:25:44 2021 +0000
@@ -2,23 +2,25 @@
#include "IO.h"
#include "SegDisplay.h"
Serial pc(USBTX, USBRX);
-Ticker flip;
-Timer debounce;
-float ADCdata;
-void toggle(){
+Ticker flip;
+Timer debounce;
+float ADCdata;
+void toggle(){
if (debounce.read_ms()>200)
Alarm=!Alarm;
}
-void flip1(){
+void flip1(){ //
crvena = !crvena;
zelena = !zelena;
zuta =!zuta;
+ wait(0.6);
+ flip.detach();
}
int main(){
- LED();
+ LED();
SegInit();
debounce.start();
-button.rise(&toggle);
+ button.rise(&toggle);
while (1)
{
ADCdata=Ain;
@@ -44,9 +46,7 @@
crvena=0;
}
else if(ADCdata>=0.9 && ADCdata<=1.0){
- flip.attach(&flip1, 0.2);
- wait(0.4);
- flip.detach();
+ flip.attach(&flip1,0.1);
}
Seg1 = SegConvert(ADCdata*10);
wait (0.5);