Vibration demo MWP


This script demonstrates how to program the MWP unit to deliver a vibration using the built-in motor.

Top

Script explanation

Here we explain the key points for operating the vibration stimuli in the MWP using the MOTORCOMMAND or ZCOMMAND. These two commands are interchangeable in this case. (ZCOMMAND can also be used in the same format to control relays for other stimuli and operate in the same way). It is recommended that you test different vibration settings to see which ones are the best for your experiments.


INCLUDE zsys 
DEFINE NUM_TIMES 2 
DEFINE WAIT_TIME 3 
 
ACTION MAIN 
 INVOKE(SAMPLE_VIBRATIONS,NUM_TIMES) 
COMPLETE

The commands above define conditions used later in the script and outline the ACTION MAIN which is an overview of the whole experiment:

  • INCLUDE zsys at the top is required for any script.
  • The two DEFINE specify a wait time in seconds and the number of times the sequence SAMPLE_VIBRATIONS in the action main will be repeated.


ACTION SAMPLE_VIBRATIONS
 
 MOTORCOMMAND("U0 D1000 M10 M-10") 
 WAIT(WAIT_TIME) 
 MOTORCOMMAND("U1 D1000 M10 M-10") 
 WAIT(WAIT_TIME) 
 MOTORCOMMAND("U2 D1000 M10 M-10") 
 WAIT(WAIT_TIME) 
 MOTORCOMMAND("U3 D1000 M10 M-10") 
 WAIT(WAIT_TIME) 
 MOTORCOMMAND("U0 D1000 M1 M-1 M1 M-1 M1 M-1 M1 M-1 M1 M-1") 
 WAIT(WAIT_TIME) 
 MOTORCOMMAND("U1 D1000 M1 M-1 M1 M-1 M1 M-1 M1 M-1 M1 M-1") 
 WAIT(WAIT_TIME) 
 MOTORCOMMAND("U2 D1000 M1 M-1 M1 M-1 M1 M-1 M1 M-1 M1 M-1") 
 WAIT(WAIT_TIME) 
 MOTORCOMMAND("U3 D1000 M1 M-1 M1 M-1 M1 M-1 M1 M-1 M1 M-1") 
 WAIT(WAIT_TIME) 
COMPLETE

The above action programs the unit to deliver a range of different sized vibratory stimuli using the MOTORCOMMAND:

  • The "M" command programs how many steps the motor rotates. In the first 4 MOTORCOMMANDS the motor will rotate 10 steps clockwise. In the last 4 MOTORCOMMANDS the motor will rotate 1 step clockwise and 1 step anticlockwise for a total of 10 steps. This can provide a smaller but smoother stimuli than using M10. The larger the M value the longer the vibration.


  • The "U" command tells the unit how big each step should be, where "U0" is a full step, "U1" is a half step, "U2" is a quarter step, "U3" is an eighth of a step.
    • If you set the step mode at a full step (U0), and the motor to move 200 steps (i.e. M200) the motor will rotate a full cycle. So if you set the step mode to a half step (U1) you will require 400 steps (M400) to rotate a full cycle etc.
    • The smallest step mode (U3) has the smallest vibration


  • The "D" command tells the unit the delay between each step. This is in units of 4.2 Microseconds. So for D1000 there is a delay between steps of 4.2 ms, which translates to a frequency of 1000/4.2, 238 Hz.


Top

Script download

Here you can download the vibration demo script for the MWP unit as a .zs file. Right click on the download link below and download / save the file as a zanscript file, i.e. in the same format: vibration_demo_mwp.zs.

Script download: Vibration Demo Mwp