Modification of Lab13 (Iot and Creator)

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Alex Alex 2 weeks, 3 days ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #55816
    Profile photo of Michael
    Michael
    Member

    Dear all,

    I want to modify Lab13 a bit and I have few questions. Additionally to the tasks given in the lab I want to write a piece of software, where I use the OLED-display and the temperature sensor of the I/O-shield to write the sensor data to the the display and then send it to a mobile device.

    Here’s my question: how would I need to modifiy the given code to send the temperature sensor data to the android app?

    #55907
    Profile photo of Alex
    Alex
    Member

    Hi Michael,
    There is already another temperature sensor object in the WiFire code, so you’ll just add another instance.
    1. In temperature_object.c, add another instance by changing the #define of TEMPERATURE_INSTANCES to 2
    2. In ui_control.c, add code to the function UIControl_pollInputSensors to read the shield thermometer and update the new temperature object instance (#1).

          
    TemperatureObject_Input(0, AdcDriver_GetTemperatureDegrees(true));  // Read temperature in Celsius
    TemperatureObject_Input(1, YourShieldTemperatureReaderFunction());  // Read shield temperature in Celsius
    

    BTW, the call graph viewer in MPLAB X is quite helpful for navigating through the code at the function level, especially to find a function’s callers.
    3. Create your function YourShieldTemperatureReaderFunction.
    4. Since the temperature sensor uses an I2C interface, you’ll need to add I2C support for the app. This involves modifying the project with Harmony (Tools->Embedded->MPLAB Harmony Configurator) and selecting Harmony Framework Configuration->Drivers->I2C->Use I2C Driver. Then you’ll need to plug in calls to the code to initialize (in APP_Initialize) and use the I2C peripheral. I haven’t done this, so I don’t have further details at this point in time.

    I hope this helps! Please let me know if you have further questions or get stuck.

    2 users thanked author for this post.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.