Map function for GPIO Output


I am currently implementing a flex sensor using an arduino board and I am able to output angles according to the resistance of the flex sensor using map function in Arduino. However, my project requires a wearable aspect which allows the user to wear on the flex sensor and measure the angle bend in the knee. Thus, using an arduino alone is not feasible in this case. Hence, I thought of connecting the output of the arduino board to the gpio pins in the cpro so the metawear app is able to output the gpio. Is there a way I can edit to allow the map function for the gpio output in the app? The problem now is that the gpio only outputs adc, which is not what I am looking for now. 

Thank you so much.


  • do you have a formula to convert resistance to bend angle?
  • As of now, I don't. I am depending on the arduino's map function to interpret the output resistance into the respective angles! I only have the resistance of 0, 45, and 90 degrees, thus the values in between is unknown to me. Do you have any suggestions? 
  • See if the flex sensor documentation provides a formula to interpret measured resistance values.  If none is provided, then you'll have to compute the resistance vs. angle relationship yourself by measuring the resistances at various angles and finding a best fit line.
This discussion has been closed.