Function returns 0

Moderator: Virt

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

Function returns 0

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

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() {

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

return Temp;

void loop() {
int val1;
double t1;

val1 = 22;
t1 = Therm(val1);

Please advise.

Thanks in advance.


Site Admin
Posts: 240
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 for more info. Thanks

Return to “Version 1.01”

Who is online

Users browsing this forum: No registered users and 1 guest