C Language Development Kit/Functions/Vibrate

From OptiWiki

Jump to: navigation, search
Description This function controls the vibrating motor. 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. This function is available only on PHL models equipped with the vibrating motor option.
void vibrate(int time);
int time
Defines the time the vibrating motor is on, in steps of 20 milliseconds. After this time the vibrating motor will be switched off. For example, time = 25 specifies half a second. time = 0 will stop the vibrating motor immediately.
Returns None
Remarks 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 'on-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. vibrate() is only available on some of the PHL models. Using vibrate() on other models will have no effect.

// This program reads and displays a barcode. After each successful barcode reading,
// it gives a good read signal on the LED, a buzzer signal and vibrates.
// Note that an extra check is made on the minimum length when the barcode symbology
// is one of the 2 of 5 codes, or Codabar. This is done because of the poor
// specifications of these symbologies.
// Note the use of a loop, repeatedly invoking readbarcode().
#include "lib.h"
#include <stdio.h>
void main( void )
    char bcr_buf[42];
    struct barcode code;
    code.min   = 1;
    code.max   = 41;
    code.text  = bcr_buf;
        if( !scanneroff())
            if( readbarcode(  ) == OK)
                if( (code.id != CODABAR) &&
                    ( code.id != I2OF5) &&
                    ( code.id != D2OF5) ||
                    ( code.length > 5))
                    goodreadled( RED, 10);
                    sound( TSTANDARD, VHIGH, SMEDIUM, SHIGH, 0);
                    vibrate( TSTANDARD );
                    scannerpower( OFF, 0);
            delay( 50 );
            scannerpower( ON, 250);

Personal tools