This function controls the vibrating motor.

Syntax

void Vibrate(
  int time, 
  int power
);

Parameters

time
[in] Sets the vibration activation time.
The unit is 20 ms.
Example: If time is 250, 250 x 20 msec will be 5 seconds.
The range of values is 1〜2,147,483,647.
The following two values have special meaning.
1.OFF_IMMEDIATELY − Immediately stop the vibration.
2.ON_CONTINUOUSLY − The vibration keeps working.
power
[in] Sets the intensity of the vibration.
ValueDescription
VIB_POWER_OFF Vibrate power OFF.
VIB_POWER_MIN Vibrate power level minimum.
VIB_POWER_MID Vibrate power level middle.
VIB_POWER_MAX Vibrate power level maximum.

Return value

None

Remarks

The vibrations will be felt by the person holding the terminal and can be used as an indicator in a noisy environment where the buzzer - controlled by the Sound function is not loud enough.
Because the handling of the vibrating motor is done by the operating system, the terminal will continue executing the application program during the time the vibrating motor is on.
After the 'time' period has elapsed, the execution is interrupted in order to switch off the vibrating motor.
Use the Delay function if you want to halt program execution until the vibrating motor is switched off again.

Requirements

Header file:
lib.h
Library file:
libSTARTUPOPH5000.a

Sample

#include <stdio.h>
#include "lib.h"

void main( void )
{
    char bcr_buf[42];
    struct barcode code;
    code.min   = 1;
    code.max   = 41;
    code.text  = bcr_buf;
    for(;;)
    {
        if( !IsScannerOff())
        {
          if( ReadBarcode( &code ) == OK)
          {
                  GoodReadLed( RED, 10);
                  Sound( TSTANDARD, VHIGH, SMEDIUM, SHIGH, 0);
                  Vibrate( TSTANDARD, VIB_POWER_MID );
                  ScannerPower( OFF, 0);
                  printf("%s\n",code.text);
          }
        }
        else
        {
            Delay( 50 );
            ScannerPower( ON, 250);
        }
        Idle();
    }
}

Last updated: 2020/10/08