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.
main.cpp@25:32acf45398b4, 2020-04-11 (annotated)
- Committer:
- montse
- Date:
- Sat Apr 11 11:00:23 2020 +0000
- Revision:
- 25:32acf45398b4
- Parent:
- 24:7f14b70fc9ef
- Child:
- 26:c1f837b137f8
Ejercicio 3 de la practica 4.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
montse | 25:32acf45398b4 | 1 | #include "mbed.h" //libreria que nos permite utilizar comandos y sentencias propias de mbed |
montse | 25:32acf45398b4 | 2 | #include <iostream> |
dan | 0:7dec7e9ac085 | 3 | |
montse | 25:32acf45398b4 | 4 | //Mediante el uso del condicional if implementar un programa que permita imprimir diferentes mensajes cuando se presionan al menos tres diferentes teclas. |
montse | 25:32acf45398b4 | 5 | |
montse | 25:32acf45398b4 | 6 | Serial com1(USBTX, USBRX); |
montse | 25:32acf45398b4 | 7 | |
montse | 25:32acf45398b4 | 8 | using namespace std; |
dan | 0:7dec7e9ac085 | 9 | |
montse | 25:32acf45398b4 | 10 | int main() |
montse | 25:32acf45398b4 | 11 | { |
montse | 25:32acf45398b4 | 12 | int tecla; |
montse | 25:32acf45398b4 | 13 | com1.printf("Cuantas veces al dia te lavas las manos? \n\n"); |
montse | 25:32acf45398b4 | 14 | if ((tecla <= 9)&&(tecla >= 3)){ |
montse | 25:32acf45398b4 | 15 | com1.printf("Eso es genial. \n"); |
montse | 25:32acf45398b4 | 16 | |
montse | 25:32acf45398b4 | 17 | com1.printf("Que mas personas sean responsables como tu :) \n\n"); |
dan | 0:7dec7e9ac085 | 18 | } |
montse | 25:32acf45398b4 | 19 | |
montse | 25:32acf45398b4 | 20 | if (tecla <3){ |
montse | 25:32acf45398b4 | 21 | com1.printf("Eso es triste :( \n"); |
montse | 25:32acf45398b4 | 22 | |
montse | 25:32acf45398b4 | 23 | com1.printf("Hazlo mas seguido y no olvides usar gel antibacterial. \n\n"); |
montse | 25:32acf45398b4 | 24 | } |
montse | 25:32acf45398b4 | 25 | |
montse | 25:32acf45398b4 | 26 | if (tecla >=10){ |
montse | 25:32acf45398b4 | 27 | com1.printf("Vaya! Tu si que te cuidas. \n"); |
montse | 25:32acf45398b4 | 28 | |
montse | 25:32acf45398b4 | 29 | } |
montse | 25:32acf45398b4 | 30 | |
montse | 25:32acf45398b4 | 31 | com1.printf("Recuerda, Si te cuidas tu, nos cuidamos todos"); |
montse | 25:32acf45398b4 | 32 | } |
montse | 25:32acf45398b4 | 33 |