Buzzer com LDR, LED e PWM
Dependencies: mbed
main.cpp
- Committer:
- guilhermepaulino
- Date:
- 2016-05-16
- Revision:
- 0:e7d459325c12
File content as of revision 0:e7d459325c12:
#include "mbed.h" AnalogIn ain(A0); DigitalOut buzzer(PTA17); PwmOut ledr(LED1); // LED vermelho int x; int main(){ while(1){ x=ain.read(); if(x < 0.4){ buzzer=0; ledr=1.0f; } else { buzzer=1; //ledr=0.0f; for(float p=0.0f; p < 1.0f; p += 0.01f){ ledr=p; wait(0.02); } } } }