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.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:1644c3e66842
- Child:
- 1:c79ac0240e88
diff -r 000000000000 -r 1644c3e66842 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Jun 26 02:00:32 2014 +0000
@@ -0,0 +1,74 @@
+#include "mbed.h"
+
+Ticker visualiza;
+Ticker cuenta;
+Ticker Led_Test;
+
+DigitalOut Testigo1(LED_RED);
+DigitalOut Testigo2(LED_GREEN);
+DigitalOut SALIDA(D7);
+
+BusOut transistores(D8,D9);
+BusOut segmentos ( D0, D1, D2, D3, D4, D5, D6);
+// tabla de segmentos
+//para d6 a d0
+const char camino1[32] = {0x3F, 0x5F, 0x7E, 0x7B, 0x77, 0x6F, 0x7D, 0x5F, 0x7E, 0x03, 0x03, 0x03, 0x03, 0x7E, 0x6F, 0x77, 0x7B, 0x7D, 0x03, 0x03, 0x03, 0x03, 0x03, 0x7E, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03};
+const char camino2[32] = {0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x7E, 0x7B, 0x5F, 0x6F, 0x03, 0x03, 0x03, 0x03, 0x03, 0x3F, 0x7E, 0x7E, 0x7D, 0x7E, 0x03, 0x3F, 0x7D, 0x7E, 0x6F, 0x77, 0x7B, 0x7E, 0x5F};
+// const char camino1[32] = {0x01, 0x02, 0x3f, 0x6f, 0x77, 0x04, 0x5f, 0x02, 0x3f, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x04, 0x77, 0x6f, 0x5f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+ //const char camino2[32] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x6f, 0x02, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x5f, 0x3f, 0x5f, 0x3f, 0xff, 0x01, 0x5f, 0x3f, 0x04, 0x77, 0x6f, 0x3f, 0x02};
+
+
+char unidades,decenas, aumento;
+
+void cambio(){
+ static bool bandera;
+ static char cont_estado;
+cont_estado ++;
+ bandera = !bandera;
+ if (bandera){
+ transistores = 0x3;
+ segmentos = camino1[unidades];
+ transistores = 0x2;
+}
+ else {
+ transistores = 0x3;
+ segmentos = camino2[decenas];
+ transistores = 0x1;
+}
+
+ }
+void conteo ()
+{
+ unidades++;
+ decenas++;
+ if (unidades > 32)
+ {
+ unidades = 0;
+ }
+ if (decenas > 32) {
+ decenas = 0;
+ }
+ }
+
+void prueba_led()
+{
+ Testigo2 = !Testigo2;
+ }
+
+int main(void)
+{
+ SALIDA = 1;
+transistores = 0x3;
+visualiza.attach(&cambio,0.008333); // tiempo de visualizacion
+cuenta.attach(&conteo,1); // tiempo de incremento de la variable
+Led_Test.attach(&prueba_led,1.7);
+Testigo1 = 1;
+Testigo2 = 1;
+ while(1)
+ {
+
+ Testigo1 = !Testigo1;
+ wait(0.5);
+
+ }
+}
\ No newline at end of file