Repositório para o trabalho semestral (Projeto Estufa) de Microcontroladores.

Dependencies:   mbed

Committer:
RickBadKan
Date:
Fri Jun 15 22:13:09 2018 +0000
Revision:
3:446af583421c
Parent:
2:397bd847dbd5
Atualiza??o dos c?digos + backup do "projeto_final".

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RickBadKan 2:397bd847dbd5 1 #include "mbed.h"
RickBadKan 2:397bd847dbd5 2
RickBadKan 2:397bd847dbd5 3 // Declaração do serial de comunicação
RickBadKan 2:397bd847dbd5 4 Serial device(p9, p10);
RickBadKan 2:397bd847dbd5 5
RickBadKan 2:397bd847dbd5 6 int main()
RickBadKan 2:397bd847dbd5 7 {
RickBadKan 2:397bd847dbd5 8 device.baud(9600);
RickBadKan 2:397bd847dbd5 9
RickBadKan 2:397bd847dbd5 10 // Char recebido
RickBadKan 2:397bd847dbd5 11 char recivedchar;
RickBadKan 2:397bd847dbd5 12
RickBadKan 2:397bd847dbd5 13 while (1)
RickBadKan 2:397bd847dbd5 14 {
RickBadKan 2:397bd847dbd5 15 if (device.readable())
RickBadKan 2:397bd847dbd5 16 {
RickBadKan 2:397bd847dbd5 17 recivedchar = device.getc();
RickBadKan 3:446af583421c 18 switch (recivedchar) {
RickBadKan 2:397bd847dbd5 19 case 'A':
RickBadKan 2:397bd847dbd5 20 device.printf("\nVocê inseriu a letra %c\n", recivedchar);
RickBadKan 2:397bd847dbd5 21 break;
RickBadKan 2:397bd847dbd5 22
RickBadKan 2:397bd847dbd5 23 case 'B':
RickBadKan 2:397bd847dbd5 24 device.printf("\nVocê inseriu a letra B\n");
RickBadKan 2:397bd847dbd5 25 break;
RickBadKan 2:397bd847dbd5 26
RickBadKan 2:397bd847dbd5 27 case 'C':
RickBadKan 2:397bd847dbd5 28 device.printf("\nVocê inseriu a letra C\n");
RickBadKan 2:397bd847dbd5 29 break;
RickBadKan 2:397bd847dbd5 30 }
RickBadKan 2:397bd847dbd5 31 }
RickBadKan 2:397bd847dbd5 32 else
RickBadKan 2:397bd847dbd5 33 {
RickBadKan 2:397bd847dbd5 34 device.printf("\nAguardando entrada...\n");
RickBadKan 2:397bd847dbd5 35 wait(3.0f);
RickBadKan 2:397bd847dbd5 36 }
RickBadKan 2:397bd847dbd5 37 }
RickBadKan 2:397bd847dbd5 38 }