Fabian van Hummel / SigInterpreter

Fork of PID by Aaron Berk

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SigInterpreter.cpp Source File

SigInterpreter.cpp

00001 #include "SigInterpreter.h"
00002 
00003 AnalogIn emg1(A0);
00004 AnalogIn emg2(A1);
00005 AnalogIn emg3(A2);
00006 AnalogIn emg4(A3);
00007 
00008 SigInterpreter::SigInterpreter() {}
00009 
00010 double SigInterpreter::readValue(int sig) {
00011     // returns the amplitude of EMG signal
00012     if(sig > 4 || sig < 1) { // RIGHT
00013         // nope
00014         return 0.0;     // check later of dit idd goeie shit is
00015     } if (sig == 1) {
00016         float input = emg1.read();
00017         return filter(input);
00018     }
00019     if (sig == 2) {
00020         float input = emg2.read();
00021         return filter(input);
00022     } 
00023     if (sig == 3) {
00024         float input = emg3.read();
00025         return filter(input);
00026     }
00027     if (sig == 4) {
00028         float input = emg4.read();
00029         return filter(input);
00030     }     
00031     return 0.0;
00032 }
00033 double SigInterpreter::filter(float input) {
00034     //filter the input)
00035     return 0.0;     //default, return the filtered input
00036 }