Function returns 0

Moderator: Virt

larsoeh
Posts: 1
Joined: Sun Mar 20, 2016 12:00 am

Function returns 0

Postby larsoeh » Sun Mar 20, 2016 12:26 am

Hi,
I have a simple function returning a double.
In the simulator (pro V1.01D), the variable that is assigned by the function is not set to the returning value, but to 0, instead of 255.15.

The below is a simple example, that fails.

void setup() {
Serial.begin(115200);
}

double Therm(int val) {
double Temp;
Temp = 273.15 - val;

return Temp;
}

void loop() {
int val1;
double t1;

val1 = 22;
t1 = Therm(val1);
Serial.println(t1);
}

Please advise.

Thanks in advance.

Lars

Simulator_admin
Site Admin
Posts: 237
Joined: Thu Feb 02, 2012 6:07 pm

Re: Function returns 0

Postby Simulator_admin » Sat Dec 10, 2016 1:37 pm

Hi, Sorry for the late reply - this seems t have slipped past us.

We just checked and the latest 1.04 version of the Simulator seems to handle this well. Email us at support@virtronics.com.au for more info. Thanks


Return to “Version 1.01”

Who is online

Users browsing this forum: No registered users and 2 guests