pmVibration (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Firmware version:

1.00 / 1.40.00


Query whether vibration has been detected by the on-board vibration sensor.

The pmVibration() function will return whether vibration has been detected since the last call. It is the responsibility of application to call pmVibration() frequently so that the information processed is up to date.

The sensivity of the vibration sensor can be adjusted by calling the function pmSetVibrationSensivity().

 

Note: pmVibration will return FALSE while accelerometer or motion sensor is open.

 

Input:

None.

 

Returns: BOOL

TRUE:

- Vibration has been detected since last call.

FALSE:

- No vibration has been detected since last call.

 

Declaration:

FUNCTION pmVibration : BOOL;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
 
pmSetVibrationSensivity(sen:=25);
 
DebugMsg(message:="Running...");
BEGIN
   IF NOT pmVibration() THEN
      DebugMsg(message:="No movement.. Sleep");
      pmWaitEvent(Vibration:=TRUE);
      DebugMsg(message:="Wakeup");
   END_IF;
END;
 
END_PROGRAM;