JEISSON CASTRO / Mbed 2 deprecated visual4m

Dependencies:   MAX7219 mbed

Files at this revision

API Documentation at this revision

Comitter:
JDC128
Date:
Tue Apr 25 15:11:12 2017 +0000
Commit message:
4 motores con visualizacion

Changed in this revision

MAX7219.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
visual.h Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r c72f6ddb0ab7 MAX7219.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MAX7219.lib	Tue Apr 25 15:11:12 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/teams/Maxim-Integrated/code/MAX7219/#b5e4379a3d90
diff -r 000000000000 -r c72f6ddb0ab7 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Apr 25 15:11:12 2017 +0000
@@ -0,0 +1,107 @@
+#include "mbed.h"
+#include "max7219.h" //libreria
+#include "visual.h"
+
+ int main()
+{ 
+   max7219_configuration_t cfg = {
+        .device_number = 1,
+        .decode_mode = 0,                              //configuracion del max7219
+        .intensity = Max7219::MAX7219_INTENSITY_5,
+        .scan_limit = Max7219::MAX7219_SCAN_8
+    };
+    
+    pantalla.init_device(cfg);
+    pantalla.enable_device(1);
+    pantalla.set_display_test();    //testeo de la matriz
+    wait(1);
+    pantalla.clear_display_test();
+    
+     mipwm.period_ms(20);
+    
+    char v;
+    while(1){
+    if (pc.readable()){
+        v=pc.getc();
+        if (v=='<')
+        
+    pc.printf("Hello World\n");
+  pc.putc(pc.getc());
+    }
+}
+    
+    
+   
+    
+  
+        
+   while(1){
+   Print_pantalla_tabla(m1up);
+   wait(1);
+   Print_pantalla_tabla(m1left);
+   wait(1);                                      //ciclo de visualizaciòn
+   Print_pantalla_tabla(m1right);
+   wait(1);
+   Print_pantalla_tabla(m2up);
+   wait(1);
+   Print_pantalla_tabla(m2left);
+   wait(1);
+   Print_pantalla_tabla(m2right);
+   wait(1);
+   Print_pantalla_tabla(m3up);
+   wait(1);
+   Print_pantalla_tabla(m3left);
+   wait(1);                                      //ciclo de visualizaciòn
+   Print_pantalla_tabla(m3right);
+   wait(1);
+   Print_pantalla_tabla(m4up);
+   wait(1);
+   Print_pantalla_tabla(m4left);
+   wait(1);
+   Print_pantalla_tabla(m4right);
+   wait(1);
+   
+   
+   
+   mipwm.pulsewidth_us(2500);
+       wait(1);
+    mipwm.pulsewidth_us(1400);
+       wait(1);
+    mipwm.pulsewidth_us(600);
+       wait(1);
+
+
+    mipwm2.pulsewidth_us(2500);
+        wait(1);
+    mipwm2.pulsewidth_us(1400);
+       wait(1);
+    mipwm2.pulsewidth_us(600);
+       wait(1);
+
+
+    mipwm3.pulsewidth_us(2500);
+       wait(1);
+    mipwm3.pulsewidth_us(1400);
+       wait(1);
+    mipwm3.pulsewidth_us(600);
+        wait(1);
+
+   
+   
+   
+   }
+
+}
+
+
+void Print_pantalla_tabla(unsigned char *pValor){
+   int i;                                                   //funcion de puntero, impresión de pantalla
+  for (i =0;i<8;i++)
+   pantalla.write_digit(1,i+1,pValor[i]);
+   
+}
+
+
+ 
+ 
+ 
diff -r 000000000000 -r c72f6ddb0ab7 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Apr 25 15:11:12 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/97feb9bacc10
\ No newline at end of file
diff -r 000000000000 -r c72f6ddb0ab7 visual.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/visual.h	Tue Apr 25 15:11:12 2017 +0000
@@ -0,0 +1,28 @@
+
+PwmOut mipwm(PA_0); // IO used by pwm_io function
+PwmOut mipwm2(PA_1);
+PwmOut mipwm3(PA_2);
+
+Max7219 pantalla(PB_15, PB_14, PB_13, PB_12); //pines
+
+Serial pc(USBTX, USBRX);
+
+void Print_pantalla_tabla(unsigned char *pValor); //variable global
+
+
+unsigned char m1up[]= {0x00,0x04,0x06,0x27,0xf7,0x06,0x04,0x00};  //secuencia 1
+unsigned char m1left[]= {0x04,0x0e,0x1f,0x00,0x00,0x20,0xf0,0x00};  //secuencia 2
+unsigned char m1right[]= {0x00,0x20,0xf0,0x00,0x00,0x1f,0x0e,0x04};  //secuencia 3
+unsigned char m2up[]= {0x00,0x04,0x06,0xa7,0xd7,0xa6,0x04,0x00};  //secuencia 4
+unsigned char m2left[]= {0x04,0x0e,0x1f,0x00,0xa0,0xd0,0xa0,0x00};  //secuencia 5
+unsigned char m2right[]= {0x00,0xa0,0xd0,0xa0,0x00,0x1f,0x0e,0x04};  //secuencia 6
+unsigned char m3up[]= {0x00,0x04,0x06,0x97,0xb7,0xf6,0x04,0x00};  //secuencia 7
+unsigned char m3left[]= {0x04,0x0e,0x1f,0x00,0x90,0xb0,0xf0,0x00};  //secuencia 8
+unsigned char m3right[]= {0x00,0x90,0xb0,0xf0,0x00,0x1f,0x0e,0x04};  //secuencia 9
+unsigned char m4up[]= {0x00,0x04,0x06,0x47,0x67,0xf6,0x04,0x00};  //secuencia 10
+unsigned char m4left[]= {0x04,0x0e,0x1f,0x00,0x40,0x60,0xf0,0x00};  //secuencia 11
+unsigned char m4right[]= {0x00,0x40,0x60,0xf0,0x00,0x1f,0x0e,0x04};  //secuencia 12
+
+
+
+