Mindstorms 3rd Party ROBOTC Drivers RobotC
[Home] [Download] [Submit a bug/suggestion] [ROBOTC Forums] [Blog] [Support this project]
Files | Defines | Functions | Variables

PIR Sensor
[HiTechnic]

Files

file  hitechnic-pir.h
 

HiTechnic PIR Sensor Driver.


Defines

#define HTPIR_I2C_ADDR   0x02
#define HTPIR_DEADBAND   0x41
#define HTPIR_READING   0x42
#define HTPIR_DEFAULT_DEADBAND   12

Functions

bool HTPIRsetDeadband (tSensors link, int deadband)
int HTPIRreadSensor (tSensors link)
int HTPIRreadSensor (tMUXSensor muxsensor)

Variables

tConfigParams HTPIR_config = {HTSMUX_CHAN_I2C, 1, 0x02, 0x42}
tByteArray HTPIR_I2CRequest
tByteArray HTPIR_I2CReply

Detailed Description

HiTechnic PIR Sensor


Define Documentation

#define HTPIR_DEADBAND   0x41

HTPIR Mode control

Definition at line 38 of file hitechnic-pir.h.

#define HTPIR_DEFAULT_DEADBAND   12
Examples:
hitechnic-pir-test1.c.

Definition at line 41 of file hitechnic-pir.h.

#define HTPIR_I2C_ADDR   0x02

HTPIR I2C device address

Definition at line 37 of file hitechnic-pir.h.

#define HTPIR_READING   0x42

HTPIR Heading Upper bits

Definition at line 39 of file hitechnic-pir.h.


Function Documentation

int HTPIRreadSensor ( tSensors  link )

Read the current levels detected by the sensor

Parameters:
linkthe HTPIR port number
Returns:
level detected by sensor, will be between -128 and 127.
Examples:
hitechnic-pir-test1.c.

Definition at line 88 of file hitechnic-pir.h.

int HTPIRreadSensor ( tMUXSensor  muxsensor )

Read the current levels detected by the sensor

Parameters:
muxsensorthe SMUX sensor port number
Returns:
level detected by sensor, will be between -128 and 127.

Definition at line 107 of file hitechnic-pir.h.

bool HTPIRsetDeadband ( tSensors  link,
int  deadband 
)

The sensor element with the PIR sensor generates continuous noise. The size of the deadband is set to minimize the number of false detections which will be reported by the sensor. If the deadband value is too small, some of the noise fluctuations will exceed the deadband threshold and will appear as actual non-zero readings.
The Deadband field may be set from 0 to 47 to define the half width of the deadband. The default value is 12.

Parameters:
linkthe HTPIR port number
deadbandthe amount
Returns:
true if no error occured, false if it did
Examples:
hitechnic-pir-test1.c.

Definition at line 68 of file hitechnic-pir.h.


Variable Documentation

tConfigParams HTPIR_config = {HTSMUX_CHAN_I2C, 1, 0x02, 0x42}

Array to hold SMUX config data for sensor

Definition at line 49 of file hitechnic-pir.h.

Array to hold I2C reply data

Definition at line 53 of file hitechnic-pir.h.

Array to hold I2C command data

Definition at line 52 of file hitechnic-pir.h.