código solenoide 0 e 1

Dependencies:   mbed

Committer:
eduardogebara
Date:
Mon May 07 20:03:47 2018 +0000
Revision:
0:ad6713197fd2
c?digo solen?ide

Who changed what in which revision?

UserRevisionLine numberNew contents of line
eduardogebara 0:ad6713197fd2 1 #include "mbed.h"
eduardogebara 0:ad6713197fd2 2
eduardogebara 0:ad6713197fd2 3 DigitalOut outcorr(D13);
eduardogebara 0:ad6713197fd2 4 bool estado = 0;
eduardogebara 0:ad6713197fd2 5
eduardogebara 0:ad6713197fd2 6 int main(){
eduardogebara 0:ad6713197fd2 7 while(1){
eduardogebara 0:ad6713197fd2 8 wait(2);
eduardogebara 0:ad6713197fd2 9 estado =! estado;
eduardogebara 0:ad6713197fd2 10 if (estado == 1){
eduardogebara 0:ad6713197fd2 11 outcorr.write(0);
eduardogebara 0:ad6713197fd2 12 }
eduardogebara 0:ad6713197fd2 13 else {
eduardogebara 0:ad6713197fd2 14 outcorr.write(1);
eduardogebara 0:ad6713197fd2 15 }
eduardogebara 0:ad6713197fd2 16 wait(0.2);
eduardogebara 0:ad6713197fd2 17 }
eduardogebara 0:ad6713197fd2 18
eduardogebara 0:ad6713197fd2 19 }
eduardogebara 0:ad6713197fd2 20