Promjenaq frekvencije ovisno o položaju prekidača

Dependencies:   mbed

Committer:
vgregl
Date:
Fri May 08 16:55:59 2015 +0000
Revision:
0:745a43b3e717
Vje?ba 4 - Tomi?i? -Gregl

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vgregl 0:745a43b3e717 1 #include "mbed.h"
vgregl 0:745a43b3e717 2 DigitalIn sw(p5);
vgregl 0:745a43b3e717 3 DigitalOut greenled (p6);
vgregl 0:745a43b3e717 4 int main() {
vgregl 0:745a43b3e717 5 sw.mode(PullUp);
vgregl 0:745a43b3e717 6 while(1) {
vgregl 0:745a43b3e717 7 if (sw==0){
vgregl 0:745a43b3e717 8 greenled= 1;
vgregl 0:745a43b3e717 9 wait (5);
vgregl 0:745a43b3e717 10 greenled = 0;
vgregl 0:745a43b3e717 11 wait(5);
vgregl 0:745a43b3e717 12 }
vgregl 0:745a43b3e717 13 else if (sw==1) {
vgregl 0:745a43b3e717 14 greenled= 0;
vgregl 0:745a43b3e717 15 wait (0.2);
vgregl 0:745a43b3e717 16 greenled = 1;
vgregl 0:745a43b3e717 17 wait(0.2);
vgregl 0:745a43b3e717 18 }
vgregl 0:745a43b3e717 19 }
vgregl 0:745a43b3e717 20 }
vgregl 0:745a43b3e717 21