Interference current stimulation program with kaji-lab ES device.
Dependencies: mbed SerialInputReactionHandler AMPulseTrain SwArr16MOSFET StrCommandHandler KajiLabES
main.cpp
- Committer:
- aktk
- Date:
- 2018-10-23
- Revision:
- 0:19a67422961f
- Child:
- 1:b97639dad576
File content as of revision 0:19a67422961f:
#include "mbed.h" #include "KajiLabES.h" #include "PMRC16ch.h" #include "sigbind.h" #include <iostream> #include <bitset> ProcessState pstate; Serial pc(USBTX, USBRX); // tx, rx DigitalOut myled1(LED1); DigitalOut myled2(LED2); DigitalOut myled3(LED3); DigitalOut myled4(LED4); KajiLabES stimulator; PMRC16ch pmrc(16); uint32_t pw;//pulse width uint32_t pp;//pulse period uint32_t ph;//pulse hight int main() { stimulator.DAADinit(); myled1 = 1; pmrc.allHiZ(); myled2 = 1; { using namespace aktk_sigbind; pc.baud(921600); pc.attach(&keyBind); pw = 100; pp = 5000; ph = 0; printKBManual(); wait(.5); } while(1) { while (pstate == WAIT_A_CERTAIN_KEY) { myled3 = (!myled3); wait(0.5); } myled3 = 1; pmrc.setPol(PMRC16ch::Cathodic); while (pstate == MAIN_ROUTINE) { for(int i = 0; i < 2; i++) { //pmrc.setTwin(i+1, (i+4)%8+1); pmrc.setTwin(i+1, (i+1)%8+1); //pmrc.setOvsO(i+1); wait_us(pp-pw); stimulator.DAAD(ph); wait_us(pw); stimulator.DAAD(0); //pmrc.allHiZ(); //wait_us(pw); } if (pstate == TERMINATED) break; } } }