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.
Diff: conversor.cpp
- Revision:
- 2:8e9dbb7523e7
- Parent:
- 1:d05e46c73155
- Child:
- 3:b0a44d2901a1
--- a/conversor.cpp Mon Jun 08 14:28:45 2020 +0000 +++ b/conversor.cpp Mon Jun 08 14:33:14 2020 +0000 @@ -1,20 +1,34 @@ #include "mbed.h" #include <math.h> -DigitalOut saida_0(D2); -DigitalOut saida_1(D3); -DigitalOut saida_2(D4); +BusOut saida_digital (D2,D3,D4); +DigitalIn botao_usuario(PC_13); +AnalogIn leitura_an(A0); -AnalogIn leitura_an(A0); Serial pc(USBTX, USBRX); float valor; +int SEQUENCIA[8]={ + 0b000, + 0b001, + 0b010, + 0b011, + 0b100, + 0b101, + 0b110, + 0b111 + }; + int main(){ pc.baud(9600); pc.printf("\r"); while(1){ + for (int i=0; i<8; i++) { + saida_digital = SEQUENCIA[i]; valor = 3.3*leitura_an.read(); //conversão propriamente dita pc.printf("\r\t%1.3f\n", valor); wait(0.5); } - } + + } +} \ No newline at end of file