encoder read old ways

Dependencies:   mbed QEI_hw SDFileSystem_Sherckuith FATFileSystem rtos

Files at this revision

API Documentation at this revision

Comitter:
eembed
Date:
Thu Aug 01 07:49:56 2019 +0000
Child:
1:4e2dc947ca3c
Commit message:
first commit

Changed in this revision

FATFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
QEI_hw.lib Show annotated file Show diff for this revision Revisions of this file
SDFileSystem_Sherckuith.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
rtos.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FATFileSystem.lib	Thu Aug 01 07:49:56 2019 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/carlos_nascimento08/code/FATFileSystem/#5fe35852ace9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QEI_hw.lib	Thu Aug 01 07:49:56 2019 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/hexley/code/QEI_hw/#53f8ae2cf502
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem_Sherckuith.lib	Thu Aug 01 07:49:56 2019 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/apm_litoral/code/SDFileSystem_Sherckuith/#b65664229800
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Aug 01 07:49:56 2019 +0000
@@ -0,0 +1,89 @@
+#include "mbed.h"
+#include "qeihw.h"
+ 
+QEIHW qei_m(QEI_DIRINV_NONE, QEI_SIGNALMODE_QUAD, QEI_CAPMODE_2X, QEI_INVINX_NONE );
+int dt_us=150;
+   float send_m_angle = 0.0;
+   float inc = 0;
+   int32_t temp, position = 0;   
+
+DigitalIn safety_14(p14);
+DigitalIn safety_15(p13);
+DigitalOut myled(LED1);
+DigitalOut myled3(LED3);
+DigitalIn safety_5(p5);
+DigitalIn safety_6(p6);
+DigitalIn safety_7(p7);
+DigitalIn safety_8(p8);
+DigitalIn safety_9(p9);
+DigitalIn safety_10(p10);
+DigitalIn safety_11(p15);
+DigitalIn safety_12(p12);
+DigitalIn safety_13(p11);
+DigitalIn safety_16(p16);
+DigitalIn safety_17(p17);
+DigitalIn safety_18(p18);
+DigitalIn safety_19(p19);
+DigitalIn safety_20(p20);
+DigitalIn safety_21(p21);
+DigitalIn safety_22(p22);
+DigitalIn safety_23(p23);
+DigitalIn safety_24(p24);
+DigitalIn safety_25(p25);
+DigitalIn safety_26(p26);
+DigitalIn safety_27(p27);
+DigitalIn safety_28(p28);
+DigitalIn safety_29(p29);
+DigitalIn safety_30(p30);
+
+Ethernet eth;
+Ticker ticker;
+
+// Encoder Constants
+float const encoder_pulses_m = 10000.0;
+#define PI 3.141592653
+
+
+void send(void)
+{
+    inc++;
+    position = qei_m.GetPosition();
+    send_m_angle = position * 2.0 * PI / encoder_pulses_m;
+    eth.write((char *)&send_m_angle, sizeof(send_m_angle));
+    //eth.write((char *)&inc, sizeof(inc));
+    myled3 = !myled3;
+    eth.send(); 
+    // wait_us(10);
+    // return 0;    
+} 
+
+int main()
+{
+    eth.set_link(Ethernet::HalfDuplex100);
+    wait_ms(1000); // Needed after startup.
+
+    if(eth.link())
+    {
+        myled = 1;
+    } else
+    {
+        myled = 0;
+    }
+    
+    int32_t temp, position = 0;                      
+    qei_m.SetDigiFilter(480UL);
+    qei_m.SetMaxPosition(0xFFFFFFFF);
+    
+    ticker.attach_us(&send, dt_us);
+//ticker.attach_us(&Control_body, dt_us);
+/*    while(1) {
+          inc++;
+          position = qei_m.GetPosition();
+          send_m_angle = position * 2.0 * PI / encoder_pulses_m;
+          eth.write((char *)&send_m_angle, sizeof(send_m_angle));
+          //eth.write((char *)&inc, sizeof(inc));
+          myled3 = !myled3;
+          eth.send(); 
+          wait_us(10);
+   }     */
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Aug 01 07:49:56 2019 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e2ed12d17f06
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtos.lib	Thu Aug 01 07:49:56 2019 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/narshu/code/rtos/#b270f864114f