We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2019-10-01
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Motion
Downloaded: 3301 times
Not followed.
License: MIT license
PIR click is a pyroelectric sensor which generates a voltage when exposed to infrared radiation emitted by live bodies.
Do you want to subscribe in order to receive notifications regarding "PIR click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "PIR click" changes.
Do you want to report abuse regarding "PIR click".
Library Description
Library contains function for reading single ADC conversion data Library contains function for reading single ADC conversion converted to miliVolts Library contains function for scaling ADC data to value in desired range Library contains constant for device address
Key functions:
uint16_t pir_getAdc( void )
- reads single ADC conversion datafloat pir_getMiliVolt( uint16_t refVoltage )
- reads 12bit ADC data and convets it to miliVoltsfloat pir_scaleResults( uint16_t inVal, uint16_t outMin, uint16_t outMax )
- scales ADC conversion data (inVal) to desired range (from outMin to outMax) and returns scaled data (outVal)Examples description
The application is composed of three sections :
void applicationTask( )
{
adcVal = pir_getAdc( );
mapOut = pir_scaleResults( adcVal, 0, 3303 );
FloatToStr(mapOut, text);
mikrobus_logWrite(" Voltage: ", _LOG_TEXT);
mikrobus_logWrite(text, _LOG_TEXT);
mikrobus_logWrite(" miliVolts ", _LOG_LINE);
Delay_ms(100);
}
Other mikroE Libraries used in the example:
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.