Skip to content

Instantly share code, notes, and snippets.

@allrobot
Last active April 14, 2022 03:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allrobot/1d105671a5186adb792bfbc5d8bd5030 to your computer and use it in GitHub Desktop.
Save allrobot/1d105671a5186adb792bfbc5d8bd5030 to your computer and use it in GitHub Desktop.
#include "EMGFilters.h"
const int SensorInputPin[] = {A0, A1, A2, A3, A4, A5};
EMGFilters myFilter[6];
SAMPLE_FREQUENCY sampleRate = SAMPLE_FREQ_500HZ;
NOTCH_FREQUENCY humFreq = NOTCH_FREQ_50HZ;
void setup()
{
for (int i = 0; i < 6; i++)
{
myFilter[i].init(sampleRate, humFreq, true, true, true);
}
Serial.begin(115200);
}
void loop()
{
// int x1= square(myFilter[0].update(analogRead(SensorInputPin[0])));
// Serial.printf("analogRead:%d\n",analogRead(SensorInputPin[0]));
// Serial.printf("%d %d %d %d %d %d\n",x1,x2,x3,x4,x5,x6);
int x[6] = {0};
for (int index = 0; index < 4; index++)
{
x[index] = myFilter[index].update(analogRead(SensorInputPin[index]));
delayMicroseconds(2000);
}
// Serial.printf("%d %d %d %d %d %d\n", x[0], x[1], x[2], x[3], x[4], x[5]);
Serial.printf("%d %d %d %d\n", x[0],x[1],x[2],x[3]);
// Serial.printf("%d %d %d\n", x[0],x[1],x[2]);
//Serial.printf("%d",x1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment