Rodrigo Vianna
/
APS-4-SisElo-2021-1-RodrigoVianna
Blinky LED test for ST Nucleo boards
main.cpp
- Committer:
- rodrigo_vianna
- Date:
- 2021-06-08
- Revision:
- 8:0f4412afd3b0
- Parent:
- 7:40ce01504ad6
File content as of revision 8:0f4412afd3b0:
#include "mbed.h" BusOut saida(D3,D4,D5,D6); AnalogIn dado_analogico(A5); DigitalIn botao(USER_BUTTON); Serial pc(USBTX,USBRX); float valor_triangular; float senoide; int main(){ pc.baud(9600); while(1){ if(botao==0){ for (int indice=0;indice<=15;indice++){ saida=indice; valor_triangular = 3.3*dado_analogico.read(); pc.printf("\r%f\n",valor_triangular); wait(0.1); } for (int indice=15; indice>=0; indice--){ saida=indice; valor_triangular=3.3*dado_analogico.read(); pc.printf("\r%f\n", valor_triangular); wait(0.1); } } if(botao==1){ for (int indice=0;indice<=360;indice++){ saida=((sin(indice+3.14159256359/180)+1)*15)/2; senoide = 3.3*dado_analogico.read(); pc.printf("\r%f\n",senoide); wait(0.1); if(botao==0){ break; } } } } }