BLE nano 2 with mbed compiler (Analog reading)


#1

Hello,
I’m trying to read analog value using temperature sensor (LM35). I’m using BLE nano v2 and Mbed compiler.
The problem I have is that I cannot get any readings!. Every value I get is zero!.

Anyone have faced the same problem before?
I tried to apply voltage from the VDD terminal to analog terminal, and the reading is still zero.

Here is the code I have used:

#include “mbed.h”

Serial pc(p29,p30);
AnalogIn TEMP(A2);

float value;
int main()
{

while(1) {
 value=TEMP;

   wait(1);
  
   pc.printf("\n\rTemperature value %f C*",value);
   }
   }

Looking for someone to help me.
Thanks.