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
- Committer:
- dnluna_
- Date:
- 2020-11-12
- Revision:
- 0:da682e9c8855
File content as of revision 0:da682e9c8855:
#include "mbed.h" //P4E5 Serial comunication(USBTX, USBRX); DigitalIn boton(p13); //Estructura de control repititiva para envir las suma de cinco números consecutivos cada vez que se presione un botóndebe enviar nuevamente la suma // y al presionarlo debe enviar nuevamente enviar la suma de cinco numero consecutivos: UTILIZAR for int main() { int contador2=0; while(1) { if (boton==1) { int x=x+1, y=x+4, suma=0; if(x==1) { for(int contador=x;contador<=y;contador++) { suma=suma+contador; } comunication.printf("Resultado= %d\n", suma); } else { int n=n+6, m=n+4; for(int contador=n; contador<=m; contador++) { suma=suma+contador; } contador2++; if(contador2>=2) { suma=suma-(5*(contador2-1)); } comunication.printf("%d\n", contador2); comunication.printf("Respuesta: %d\n",suma); } } wait(1); } }