TOP Contributors

  1. MIKROE (2660 codes)
  2. Alcides Ramos (357 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (137017 times)
  2. FAT32 Library (70143 times)
  3. Network Ethernet Library (56029 times)
  4. USB Device Library (46353 times)
  5. Network WiFi Library (41968 times)
  6. FT800 Library (41295 times)
  7. GSM click (29062 times)
  8. mikroSDK (26501 times)
  9. PID Library (26452 times)
  10. microSD click (25423 times)
Libstock prefers package manager

Package Manager

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]

< Back
mikroSDK Library

Proximity 10 click

Rating:

5

Author: MIKROE

Last Updated: 2019-08-20

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Proximity

Downloaded: 2171 times

Not followed.

License: MIT license  

Proximity 10 Click is a versatile proximity detection device on a Click board. It can detect a foreign object distanced up to 200cm.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Proximity 10 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Proximity 10 click" changes.

Do you want to report abuse regarding "Proximity 10 click".

  • mikroSDK Library 2.0.0.0
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

Proximity 10 click

Proximity 10 click

Native view of the Proximity 10 click board.

View full image
Proximity 10 click

Proximity 10 click

Front and back view of the Proximity 10 click board.

View full image

Library Description

This library allows user to measure proximity between object and sensor. Also the ALS, temperature and VDD measurement can be performed in the same time and on the same way. The entire control of the Proximity 10 Click board can be perfomed by using this library, by writing to the registers, reading from the registers, writing desired parameters, checking the response, interrupt status checking and sending a commands. For more details check documentation.

Key functions:

  • T_PROXIMITY10_RETVAL proximity10_readBytes( uint8_t regAddr, uint8_t *dataOut, uint8_t nBytes ) - This function reads the desired number od bytes from the registers..
  • T_PROXIMITY10_RETVAL proximity10_writeByte( uint8_t regAddr, uint8_t dataIn ) - This function writes a one byte data to the desired register.
  • T_PROXIMITY10_RETVAL proximity10_send_command( uint8_t _command ) - This function allows user to execute a desired command and checks the response.

Examples description

The application is composed of three sections :

  • System Initialization - Initializes peripherals and pins.
  • Application Initialization - Initializes I2C serial interface and performs a device wake up, reset and all necessary configurations. The device will wake up and performs a measurements every 10 milliseconds.
  • Application Task - (code snippet) - Reads the proximity PS1 data value and sends result to the uart terminal. If measured proximity value is greater than selected proximity threshold value, the interrupt will be generated and the message will be showed on the uart terminal. When interrupt is generated the Sound function will make an alarm sound with determined duration depending on the detected proximity value, how much is object away or close from the sensor.
void applicationTask()
{
    proximity10_readWord( _PROXIMITY10_PS1_DATA_REG, &proximity );
    
    WordToStr( proximity, text );
    mikrobus_logWrite( "** Proximity PS1 : ", _LOG_TEXT );
    mikrobus_logWrite( text, _LOG_LINE );
    
    int_status = proximity10_check_int_status( _PROXIMITY10_PS1_INT_FLAG, _PROXIMITY10_INT_CLEAR_DIS );
    
    if (int_status == _PROXIMITY10_PS1_INT_FLAG)
    {
        mikrobus_logWrite( "** Object is detected **", _LOG_LINE );
        
        alarm_dur = proximity / 100;
        alarm_dur = alarm_dur + 35;
        alarm_dur = (float)(alarm_dur * 0.30928);
        alarm_dur = 180 - alarm_dur;
        
        Sound_Play( 1400, alarm_dur );
        Delay_ms( 100 );
    }
    else
    {
        Delay_ms( 200 );
    }
    mikrobus_logWrite( "**************************************", _LOG_LINE );
}

Additional Functions :

  • checkResponse - Sends an error code message to the uart terminal if error code is detected in the response.

Other mikroE Libraries used in the example:

  • Conversions
  • I2C
  • UART
  • Sound

Additional notes and informations

Depending on the development board you are using, you may need USB UART clickUSB 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.

ALSO FROM THIS AUTHOR

Charger 23 click

0

Charger 23 Click is a compact add-on board providing a single-cell battery charging solution. This board features the ISL78693, a single-cell Li-ion or Li-polymer battery charger from Renesas. The ISL78693 can operate with an input voltage as low as 2.6V and works as a linear charger with the battery charged in a Constant Current/Constant Voltage (CC/CV) profile. The charge current is selectable with an external resistor between 250 and 500mA. Additional features include the preconditioning of an over-discharged battery, an NTC thermistor interface for charging the battery in a safe temperature range, automatic recharge, and more.

[Learn More]

IR Grid 3 click

0

IR Grid 3 click is a thermal imaging sensor. It has an array of 768 very sensitive, factory calibrated IR elements (pixels), arranged in 32 rows of 24 pixels, each measuring an object temperature up to 300˚C within its local Field of View (FOV). The MLX90640ESF-BAA IR sensor used on this Click board™ has only four pins, and it is mounted inside of the industry standard TO39 package.

[Learn More]

Flash click

0

The Flash memory module used on this Click board is the EN25Q80B, an 8 Mbit serial Flash memory with 4 KB Uniform Sector, from EON Silicon Solutions. The Flash memory density is usually expressed in bits, so exactly 8,388,608 bits are organized in units (or words, also known as bytes) of 8 bits, which gives 1,048,576 bytes of data memory.

[Learn More]