Firmata connection with Ultrasonic sensor

Hello,

I would like to connect my ultrasonic sensor from Arduino to openFrameworks with Firmata. I was pulling the code from the Ping and Firmata examples. However, it reads some very weird digits like “üñýüüüüü” rather than the distance in inches.

Below is my code and can someone tell me what have I done wrong please?

#include <Firmata.h>  
  
const int pingPin = 7;  

void setup()  
{  
    Firmata.begin();  
}  

void loop()  
{  
   while(Firmata.available()) {  
      Firmata.processInput();  
   }  

   Firmata.sendAnalog(pingPin, computeDistance());  
}  

long computeDistance(){  
 long duration, inches, cm;  
  pinMode(pingPin, OUTPUT);  
  digitalWrite(pingPin, LOW);  
  delayMicroseconds(2);  
  digitalWrite(pingPin, HIGH);  
  delayMicroseconds(5);  
  digitalWrite(pingPin, LOW);  

 
  pinMode(pingPin, INPUT);  
  duration = pulseIn(pingPin, HIGH);  

  // convert the time into a distance  
  return microsecondsToInches(duration);  

}  

long microsecondsToInches(long microseconds)  
{  
  return microseconds / 74 / 2;  
}  

// long microsecondsToCentimeters(long microseconds) 
// {  
//   return microseconds / 29 / 2;  
// }

can someone tell me what have I done wrong please?

Besides crossposting? You used Firmata.