Dominique Clevers / Mbed 2 deprecated TEST

Dependencies:   Encoder HIDScope MODSERIAL mbed

Fork of TEST by Daan

Files at this revision

API Documentation at this revision

Comitter:
Daanmk
Date:
Wed Oct 01 13:05:27 2014 +0000
Child:
1:c66edcd91108
Commit message:
Test met hidscope;

Changed in this revision

Encoder.lib Show annotated file Show diff for this revision Revisions of this file
HIDScope.lib Show annotated file Show diff for this revision Revisions of this file
MODSERIAL.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/Encoder.lib	Wed Oct 01 13:05:27 2014 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/vsluiter/code/Encoder/#2dd7853c911a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HIDScope.lib	Wed Oct 01 13:05:27 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/tomlankhorst/code/HIDScope/#e44574634162
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MODSERIAL.lib	Wed Oct 01 13:05:27 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/MODSERIAL/#180e968a751e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 01 13:05:27 2014 +0000
@@ -0,0 +1,69 @@
+/***************************************/
+/*                                     */
+/*   BRONCODE GROEP 5, MODULE 9, 2014  */
+/*       *****-THE SLAP-******         */
+/*                                     */
+/* -Dominique Clevers                  */
+/* -Rianne van Dommelen                */
+/* -Daan de Muinck Keizer              */
+/* -David den Houting                  */
+/* -Marjolein Thijssen                 */
+/***************************************/
+#include "mbed.h"
+#include "MODSERIAL.h"
+#include "encoder.h"
+#include "HIDScope.h"
+//Define objects
+Ticker log_timer;
+HIDScope scope(4);
+PwmOut      red(LED_RED);
+PwmOut      green(LED_GREEN);
+PwmOut      blue(LED_BLUE);
+AnalogIn    emgbc(PTB0); //Onderste bordje biceps meting
+AnalogIn    emgtr(PTB1); //Tweede bordje triceps meting
+//DigitalOut motordirA(PTD3);
+//DigitalOut motordirB(PTD1);
+//Encoder motor1(PTD0,PTC9);
+//Encoder motor2(PTD5,PTC8);
+
+MODSERIAL   pc(USBTX,USBRX);
+//float emg1,emg2,emg1_high,emg2_high,emg1filtered,emg2filtered;
+
+//void meten()
+//{
+//    //int i=0;
+//    //emg signaal verwerken en offset verwijderen:
+//    emg1 = (emgbc.read()-0.5)*2;           /* BICEPS */
+//    emg2 = (emgtr.read()-0.5)*2;          /* TRICEPS */
+//}
+void looper()
+{
+    /*variable to store value in*/    
+    uint16_t emg_value0;
+    uint16_t emg_value1;
+    /*put raw emg value both in red and in emg_value*/
+    red.write(emgbc.read());      // read float value (0..1 = 0..3.3V)
+    blue.write(emgtr.read());
+    emg_value0 = emgbc.read_u16();
+    emg_value1 = emgtr.read_u16();  // read direct ADC result (0..4096 = 0..3.3V)
+    /*send value to PC. Line below is used to prevent buffer overrun */
+    scope.set(0,emg_value0);
+    scope.set(1,red.read());
+    scope.set(2,emg_value1);
+    scope.set(3,blue.read());
+    scope.set(4,emg_value1);
+    scope.set(5,blue.read());
+    scope.send();
+}
+
+int main()
+{
+    /*setup baudrate. Choose the same in your program on PC side*/
+    pc.baud(115200);
+    /*set the period for the PWM to the red LED*/
+    red.period_ms(2);
+    log_timer.attach(looper, 0.005);
+    while(1) //Loop
+    {
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 01 13:05:27 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file