Practica_6_-_Ejercicio_02

Dependencies:   mbed TextLCD

Committer:
rgsbuap
Date:
Fri Oct 04 16:19:52 2019 +0000
Revision:
26:29f649949409
Parent:
25:90e7333db6a7
Child:
27:eb32f100130f
Funciones con y sin argumento (sin retorno)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dan 0:7dec7e9ac085 1 #include "mbed.h"
rgsbuap 26:29f649949409 2 Serial pc(USBTX,USBRX);
rgsbuap 26:29f649949409 3
rgsbuap 26:29f649949409 4
rgsbuap 26:29f649949409 5 void funcion1(void); //Funcion sin argumento y sin regreso de dato
rgsbuap 26:29f649949409 6 void funcion2(char);//Funcion con argumento y sin retorno
dan 0:7dec7e9ac085 7
rgsbuap 26:29f649949409 8 int main()
rgsbuap 26:29f649949409 9 {
rgsbuap 26:29f649949409 10 funcion1();
rgsbuap 26:29f649949409 11 while (1){
rgsbuap 26:29f649949409 12 char variable1;
rgsbuap 26:29f649949409 13 variable1 = pc.getc();
rgsbuap 26:29f649949409 14 funcion2(variable1);
rgsbuap 26:29f649949409 15 }
rgsbuap 26:29f649949409 16 }
rgsbuap 26:29f649949409 17
dan 0:7dec7e9ac085 18
rgsbuap 26:29f649949409 19 void funcion1()
rgsbuap 26:29f649949409 20 { pc.printf("FUNCION SIN ARGUMENTO Y SIN RETORNO\r\n");
rgsbuap 26:29f649949409 21 wait(1);
rgsbuap 26:29f649949409 22 }
rgsbuap 26:29f649949409 23
rgsbuap 26:29f649949409 24 void funcion2(char hola)
rgsbuap 26:29f649949409 25 {if(hola=='5')
rgsbuap 26:29f649949409 26 {
rgsbuap 26:29f649949409 27 pc.printf("variable es %c", hola);
stevep 4:81cea7a352b0 28 }
rgsbuap 26:29f649949409 29 else if(hola == '6')
rgsbuap 26:29f649949409 30 {
rgsbuap 26:29f649949409 31 pc.printf("variable es %c", hola);
rgsbuap 26:29f649949409 32 }
rgsbuap 26:29f649949409 33 else{
rgsbuap 26:29f649949409 34 pc.printf("FUNCION CON ARGUMENTO Y SIN RETORNO\r\n");
rgsbuap 26:29f649949409 35 }
rgsbuap 26:29f649949409 36 wait(1); }