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@26:0abd50bf69ae, 2020-04-11 (annotated)
- Committer:
- montse
- Date:
- Sat Apr 11 20:25:47 2020 +0000
- Revision:
- 26:0abd50bf69ae
- Parent:
- 25:2c225aab91ae
- Child:
- 27:681516f418e5
Ejercicio 3 de la practica 5
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
montse | 26:0abd50bf69ae | 1 | #include "mbed.h" //libreria que nos permite utilizar comandos y sentencias propias de mbed |
montse | 25:2c225aab91ae | 2 | |
montse | 26:0abd50bf69ae | 3 | /*Diseñar un programa que permita adquirir el valor de un botón de la tarjeta (elegir cualquiera) y dependiendo de si está en alto o en bajo enviar un mensaje de botón |
montse | 26:0abd50bf69ae | 4 | presionado o botón no presionado. (Utilizar una función con argumentos y sin retorno de valor)*/ |
dan | 0:7dec7e9ac085 | 5 | |
montse | 25:2c225aab91ae | 6 | Serial com1(USBTX, USBRX); |
montse | 25:2c225aab91ae | 7 | |
dan | 0:7dec7e9ac085 | 8 | |
montse | 26:0abd50bf69ae | 9 | void Boton(int Si, int No) |
montse | 25:2c225aab91ae | 10 | { |
montse | 26:0abd50bf69ae | 11 | int pulsado; |
montse | 26:0abd50bf69ae | 12 | |
montse | 26:0abd50bf69ae | 13 | pulsado = Si; |
montse | 26:0abd50bf69ae | 14 | |
montse | 26:0abd50bf69ae | 15 | com1.printf("El boton esta pulsado \n", pulsado); |
montse | 26:0abd50bf69ae | 16 | |
montse | 25:2c225aab91ae | 17 | |
montse | 26:0abd50bf69ae | 18 | int sinpulsar; |
montse | 26:0abd50bf69ae | 19 | |
montse | 26:0abd50bf69ae | 20 | sinpulsar = No; |
montse | 26:0abd50bf69ae | 21 | |
montse | 26:0abd50bf69ae | 22 | com1.printf("El boton no esta pulsado \n", sinpulsar); |
montse | 26:0abd50bf69ae | 23 | |
montse | 25:2c225aab91ae | 24 | } |
montse | 25:2c225aab91ae | 25 | |
montse | 26:0abd50bf69ae | 26 | int main () |
montse | 26:0abd50bf69ae | 27 | { |
montse | 26:0abd50bf69ae | 28 | int e1,e2; |
montse | 26:0abd50bf69ae | 29 | |
montse | 26:0abd50bf69ae | 30 | e1 = 0; |
montse | 26:0abd50bf69ae | 31 | e2 = !e1; |
montse | 26:0abd50bf69ae | 32 | |
montse | 26:0abd50bf69ae | 33 | Boton(e1,e2); |
montse | 26:0abd50bf69ae | 34 | |
montse | 26:0abd50bf69ae | 35 | |
montse | 26:0abd50bf69ae | 36 | } |