LED Demo with proximity sensor support for nexpaq development system
Dependencies: MAX44000 nexpaq_mdk
Fork of LED_Prox_Demo by
LED Prox Demo
MAX32625NEXPAQ development module
This project is a demonstration application for the MAX32625NEXPAQ development module. You will need the nexpaq application and a compatible phone to run this demo, along with the MAX44000PMB1# peripheral module. This project demonstrates polling the proximity sensor to use it like a button and sending the information back to the application running on the phone, and the phone controlling the on board RGB LED to create different colors.
Go to the nexpaq developers hub for details on how to load the code for the tile into the application.
Resources
- nexpaq App Tile Files: led_prox_demo.zip
- MAX44000PMB1# product page: www.maximintegrated.com/max44000pmb1
- nexpaq website: nexpaq.com
- nexpaq App download: nexpaq.com/app
- nexpaq Developer hub: developers.nexpaq.com/max-development
Diff: main.cpp
- Revision:
- 7:85c8f02ae327
- Parent:
- 5:7d8e69b1d3b6
- Child:
- 8:42704f06a339
--- a/main.cpp Fri Sep 23 17:10:59 2016 +0000 +++ b/main.cpp Fri Sep 23 18:53:57 2016 +0000 @@ -11,9 +11,9 @@ #endif MAX44000 max44000(P1_6, P1_7); -DigitalOut ledR(P2_4, LED_OFF); -DigitalOut ledG(P2_5, LED_OFF); -DigitalOut ledB(P2_6, LED_OFF); +PwmOut ledR(P2_4); +PwmOut ledG(P2_5); +PwmOut ledB(P2_6); DigitalIn button(P0_1, PullUp); /***** Definitions *****/ @@ -36,9 +36,9 @@ /***** Functions *****/ void my_function_CMD_2700(unsigned char *pData, unsigned char len){ unsigned char response = 0x00; - ledR = (pData[0]>0) ? LED_ON : LED_OFF ; - ledG = (pData[1]>0) ? LED_ON : LED_OFF ; - ledB = (pData[2]>0) ? LED_ON : LED_OFF ; + ledR = 1.0f - (pData[0] / 255.0f); + ledG = 1.0f - (pData[1] / 255.0f); + ledB = 1.0f - (pData[2] / 255.0f); np_api_upload(0x2701, &response, 1); } @@ -49,6 +49,9 @@ error("MDK Register Failed"); } max44000.init(MAX44000::MODE_ALS_PROX, MAX44000::ALSTIM_64X, MAX44000::ALSPGA_1X, MAX44000::DRV_110); + ledR = 1.0f; + ledG = 1.0f; + ledB = 1.0f; } void app_loop() {