- 11th May 2017 at 8:02 am #64576
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?12th May 2017 at 1:50 pm #64577
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.
You must be logged in to reply to this topic.