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@1:0b9be892ceaf, 2020-04-03 (annotated)
- Committer:
- yiato
- Date:
- Fri Apr 03 19:34:28 2020 +0000
- Revision:
- 1:0b9be892ceaf
- Parent:
- 0:f8d824abdf66
- Child:
- 2:976e71d7270c
ejemplo 2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yiato | 0:f8d824abdf66 | 1 | #include "mbed.h" |
yiato | 0:f8d824abdf66 | 2 | |
yiato | 0:f8d824abdf66 | 3 | //programa que genera una función con argumentos y con retorno de valor |
yiato | 0:f8d824abdf66 | 4 | |
yiato | 0:f8d824abdf66 | 5 | Serial com1(USBTX, USBRX); |
yiato | 0:f8d824abdf66 | 6 | |
yiato | 0:f8d824abdf66 | 7 | int suma(int a, int b); //declaración de funcion |
yiato | 0:f8d824abdf66 | 8 | |
yiato | 0:f8d824abdf66 | 9 | |
yiato | 0:f8d824abdf66 | 10 | int main() |
yiato | 0:f8d824abdf66 | 11 | { |
yiato | 0:f8d824abdf66 | 12 | int suma(int a, int b); |
yiato | 0:f8d824abdf66 | 13 | } |
yiato | 0:f8d824abdf66 | 14 | |
yiato | 0:f8d824abdf66 | 15 | int suma(int a, int b) |
yiato | 0:f8d824abdf66 | 16 | { |
yiato | 1:0b9be892ceaf | 17 | int variable1, variable2, suma; |
yiato | 1:0b9be892ceaf | 18 | variable1=10; |
yiato | 1:0b9be892ceaf | 19 | variable2=4; |
yiato | 1:0b9be892ceaf | 20 | suma= variable1 + variable2 ; |
yiato | 1:0b9be892ceaf | 21 | while(1); |
yiato | 1:0b9be892ceaf | 22 | { |
yiato | 1:0b9be892ceaf | 23 | com1.printf("la suma es igual a %d \n", suma); |
yiato | 1:0b9be892ceaf | 24 | wait(1); |
yiato | 1:0b9be892ceaf | 25 | } |
yiato | 1:0b9be892ceaf | 26 | return (suma); |
yiato | 0:f8d824abdf66 | 27 | } |