code not running on Sim

This forum is for all topics related to Simulator for Arduino v0.98. Please include sample code where possible.

Moderator: Adrian

dhruvdroids
Master Class
Posts: 14
Joined: Tue Dec 25, 2012 6:03 am

Re: code not running on Sim

Postby dhruvdroids » Fri Jan 11, 2013 12:58 am

I ll check out the 180.0/PI fix
Thanks for the reply

dhruvdroids
Master Class
Posts: 14
Joined: Tue Dec 25, 2012 6:03 am

Re: code not running on Sim

Postby dhruvdroids » Wed Jan 16, 2013 4:49 am

Hello, I tried using the 180.0/PI, still no success.
Kindly find a solution to this and all other related issue since I am still unable to simulate my code(Which is nearly 600 lines). I am therefore having a hard time debugging the code by running it on my arduino(the board is doing a pretty job though).

User avatar
Adrian
Super user
Posts: 56
Joined: Thu Jan 10, 2013 10:22 pm

Re: code not running on Sim

Postby Adrian » Wed Jan 16, 2013 7:33 am

Hello there,

I've been reading through your post, thanks for all of the updates, it's really useful to have someone hammer the code with a big project. :D Please be patient, we are working through the lists. Although we test the code internally, it is impossible to test for everything, that is why we value users reporting anomalies to us.

You may be interested that I have just tried the following on 98A3 and the Pro version. Would you be kind enough to try the following code snippet and let me know exactly what (if any) output that you get? By the way, it appears to work with and without the ".0" added to 180 (180.0) in 98A3
Using Pro 98 it works with the ".0" yet returns PI if the ".0" is omitted.

Code: Select all

void setup(){
}

float ans = 0;

void loop() {
 ans= 180.0/PI;
}


Kind regards
Adrian
Apologies for being opinionated - it's nothing personal, feel free to complain.
usual system: Pro V0.98 Arduino Mega 2560 Samsung i5-3210M 2.5Ghz 6GB windows home premium SP1

dhruvdroids
Master Class
Posts: 14
Joined: Tue Dec 25, 2012 6:03 am

Re: code not running on Sim

Postby dhruvdroids » Fri Jan 18, 2013 8:39 pm

Thanks for the response. I am grateful to be a part of this debugging team 8-). I have tried the snippet you sent (in 0.98A)

Code: Select all

void setup(){
}

float ans = 0;

void loop() {
 ans= 180.0/PI;
}

and the results are as follows
with the ".0", I get the correct result
without the ".0", I get 180 :?:
I am also finding all possible ways to write my code(statements) which give a correct output. I'll post as soon as I am done

dhruvdroids
Master Class
Posts: 14
Joined: Tue Dec 25, 2012 6:03 am

Re: code not running on Sim

Postby dhruvdroids » Fri Jan 18, 2013 9:37 pm

Hi, i tried the following code on the beta 0.98A5

Code: Select all

void setup(){
}

float ans = 0;

void loop() {
 ans= 180.0/PI;
}

And it returns the correct out with or without the ".0" :D
But a serious problem has crept up, the following statement which had been running correctly since the beginning(0.98 onwards) now gives incorrect result
float beta = atan(p_foot/q_foot) * 180/PI;

for p_foot = -30 and q_foot = 200, the result ought to be -8.5deg. But it returns -0.1488, which is the result of atan(p_foot/q_foot) only. The factor 180/PI has no effect on the statement although 180/PI gives 57.29 as result... :(

User avatar
Adrian
Super user
Posts: 56
Joined: Thu Jan 10, 2013 10:22 pm

Re: code not running on Sim

Postby Adrian » Fri Jan 18, 2013 10:25 pm

Hi again,
Many thanks for your input :D
I don't have a board to hand, but tested in latest sim & confirmed values with OpenOffice Calc

Code: Select all

float p_foot = -30;
float q_foot = 200;
void loop() {
float beta = atan(p_foot/q_foot);
float beta = 180/PI;
float beta = atan(p_foot/q_foot)  / PI * 180;
}

(Please use the "bare minimum" button & post working snippets if you can - then there is no ambiguity :D )

Yes I concure with you - I returned....
-0.148889947609497
57.2957795130823 (BTW did you output to Serial, as that will round by default)
-0.148889947609497 (so returned the ATAN() component)

HOWEVER, if you rearrange the equation, it works ;)

Code: Select all

float p_foot = -30;
float q_foot = 200;
void loop() {
float beta = atan(p_foot/q_foot);
float beta = 180/PI;
float beta = 180 * atan(p_foot/q_foot)  / PI ;
}
Apologies for being opinionated - it's nothing personal, feel free to complain.
usual system: Pro V0.98 Arduino Mega 2560 Samsung i5-3210M 2.5Ghz 6GB windows home premium SP1

dhruvdroids
Master Class
Posts: 14
Joined: Tue Dec 25, 2012 6:03 am

Re: code not running on Sim

Postby dhruvdroids » Sun Jan 20, 2013 5:28 am

Hi, just wanted to clear the round confusion, I omitted the remaining decimal digits intentionally
And for the Solution I will check it out
Thanks again


Return to “Version 0.98”

Who is online

Users browsing this forum: No registered users and 1 guest