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.
Revision 25:ca5fce342593, committed 2020-04-12
- Comitter:
- cielo
- Date:
- Sun Apr 12 04:34:49 2020 +0000
- Parent:
- 24:7f14b70fc9ef
- Commit message:
- Suma
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Apr 08 11:03:25 2019 +0100 +++ b/main.cpp Sun Apr 12 04:34:49 2020 +0000 @@ -1,12 +1,36 @@ -#include "mbed.h" - -DigitalOut myled(LED1); +#include <stdio.h> +#define letra_a 97 // A EN MINUSCULA +#include<iostream> +#include<mbed.h> -int main() { - while(1) { - myled = 1; - wait(0.2); - myled = 0; - wait(0.2); +//PARA REPETIR LA SUMA PRESIOAR "a" y luego enter. +using namespace std; +Serial com1(USBTX,USBRX); // PARA USAR LOS PINES UART +int main() +{ + int sum1=0; + int num,i,auxcon; + char letra; + + + com1.printf("ingrese un numero entero: "); + com1.scanf("%d",&num); + + while (1) + { + letra=getchar(); + + if (letra == letra_a) + { + auxcon=num; + for(i=1;i<=5;i++) + { + auxcon++; + sum1=sum1+auxcon; + } + com1.printf("La suma de los 5 numeros cosecutivos es:%d \n",sum1); + } -} + } + } +