Recent Topics › Forums › Development › EMS Example
Tagged: EMS
- This topic has 1 reply, 2 voices, and was last updated 8 years, 4 months ago by H2L.
-
AuthorPosts
-
July 11, 2016 at 10:48 pm #310
Can you provide an example and/or more complete documentation of the Arduino EMS functions? I’ve mastered the sending of commands and receiving data from UH and would now like to start getting the fingers and wrist to move.
initEMS()
connectMUX()
keepVoltage()
updateEMS()
updateEMS_HighVoltage()
setEMS_LOW()
setStimulationTime()
setStimulationChannel()
setStimulationVoltage()- This topic was modified 1 year, 10 months ago by H2L.
July 12, 2016 at 3:48 am #312@tak22
Thank you for your question. When you wish to move the hands,
wrist or fingers of the wearer, a few things need to be done with the code.– Initialize EMS
– Configure EMS parameters (intensity and duration)
– Pick the electrode you wish to deliver EMS with.
– Update EMSThe following sample shows how a single instance of EMS can be
configured and then delivered upon the insertion of a serial command.You will need to. . .
SET EMS PARAMETERS and PICK ELECTRODE TO DELIVER EMS.
after that. . .
compile the code, bring up the serial monitor and insert ‘d’
to activate the stimulation.#include <UH.h> UH uh; // create an UH object int inByte = 0; int voltage; int channel; void setup(){ // initialize serial communication: Serial.begin(115200); // initialize EMS uh.initEMS(); // SET EMS PARAMETERS voltage = 8; // min: 0 max: 12 uh.stimuTimeCount = 650; // min: 0 max: 650 // PICK ELECTRODE TO DELIVER EMS channel = 0; // channel 0: Contracts Hand // channel 1: Pulls in Fingers (Index/Middle/Ring) // channel 2: Pulls in Fingers (Middle/Ring/Pinky) // channel 3: Pulls in Fingers (Ring/Pinky) // channel 4: Releases Hand // channel 5: extends Index Finger // channel 6: Tingle on forearm // channel 7: Pulls in Fingers (Index/Middle) } void loop(){ // update EMS uh.updateEMS(); } void serialEvent() { if(Serial.available()>0){ inByte = Serial.read(); if (inByte == 100 || inByte == 68){ // when 'd' is inputted. . . // countdown Serial.print("3..."); delay (1000); Serial.print("2..."); delay (1000); Serial.print("1..."); delay (1000); // deliver stimulation uh.setStimulationChannel(channel); uh.setStimulationTime(); uh.setStimulationVoltage(voltage); for(int i=0;i<50;i++){uh.keepVoltage(voltage);} Serial.print("\nstimulate!\n\n"); } } }
- This reply was modified 8 years, 4 months ago by H2L.
-
AuthorPosts
- You must be logged in to reply to this topic.