Arm Mbed and Pelion Device Management support forum

FRDM KL25Z with Prox Sensor HCRS04

I need help with this code. I am not 100% sure why it won’t compile.

The error I receive is Error: No instance of constructor “ultrasonic::ultrasonic” matches the argument list in “main.cpp”, Line: 33, Col: 17.

The code I received this from is through this URL
https://os.mbed.com/teams/Sudolearn/code/FRDM_HCSR04//file/5fb712f78508/main.cpp/

Thanks in advance.

P.S. Yes I have the header and cpp file downloaded into the same location as the main.

#include “ultrasonic.h”

DigitalIn echo(D9); // Echo pin on Proximity sensor set as input
DigitalOut trig(D8); // Trig Pin on Proximity sensor set as output

DigitalOut rled(LED_RED); // LED in bedroom
DigitalOut bled(LED_BLUE); // LED in living room

Serial pc(USBTX, USBRX);

void dist(int distance){ // put code here to exectue when the distance has changed
if(distance < 10) {
// this will be the case when the person is within 10 cm of the sensor
pc.printf(“The status of the bedroom light is on. \n”);
pc.printf(“The status of the bedroom fan is on. \n”);
pc.printf(“The status of the bedroom TV is on. \n”);
pc.printf(“The status of the living room light is off \n”);
rled = !rled;
printf(“Distance %d mm \r\n”,distance);
}
else{
// this will be the case when the person walks > than 10 cm away from sensor
pc.printf(“The status of the bedroom lamp is off. \n”);
pc.printf(“The status of the bedroom TV is off. \n”);
pc.printf(“The status of the bedroom fan is off. \n”);
pc.printf(“The status of the living room light is on. \n”);
bled = !bled;
printf(“Distance %d mm \r\n”,distance);
}
}
ultrasonic mu(PTC, PTC, .1, 1, &dist);

int main() {
mu.startUpdates();
while(1){
mu.checkDistance();
}
}