Daniel Avendaño / Mbed 2 deprecated P4E5

Dependencies:   mbed FXOS8700Q

Files at this revision

API Documentation at this revision

Comitter:
dnluna_
Date:
Thu Nov 12 07:08:53 2020 +0000
Commit message:
use for;

Changed in this revision

FXOS8700Q.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FXOS8700Q.lib	Thu Nov 12 07:08:53 2020 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/Freescale/code/FXOS8700Q/#aee7dea904e2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 12 07:08:53 2020 +0000
@@ -0,0 +1,43 @@
+#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);
+}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Nov 12 07:08:53 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file