TOP Contributors

  1. MIKROE (2762 codes)
  2. Alcides Ramos (374 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (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 (139250 times)
  2. FAT32 Library (71746 times)
  3. Network Ethernet Library (57117 times)
  4. USB Device Library (47429 times)
  5. Network WiFi Library (43082 times)
  6. FT800 Library (42403 times)
  7. GSM click (29835 times)
  8. mikroSDK (28074 times)
  9. PID Library (26885 times)
  10. microSD click (26198 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: 2523 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

GainAMP click

11

GainAMP click carries the LTC®6912 dual channel, low noise, digitally programmable gain amplifier (PGA). The click is designed to work on either 3.3V or 5V power supply. It communicates with the target MCU over SPI interface, with additional functionality provided by the following pins on the mikroBUS line: AN, RST.

[Learn More]

Remote Temp click

5

Remote Temp Click is a temperature sensing Click board, which features the EMC1833 from Microchip, a specifically designed IC, capable of measuring remote temperature.

[Learn More]

Servo Click

0

Servo Click is a 16-channel PWM servo driver with the voltage sensing circuitry. It can be used to simultaneously control 16 servo motors, each with its own programmable PWM signal.

[Learn More]