Wiring Forum
http://wiring.org.co/cgi-bin/yabb/YaBB.pl
Programming Questions & Help >> Programs >> int test; test=!0?
http://wiring.org.co/cgi-bin/yabb/YaBB.pl?num=1241724172

Message started by Titus on 05/07/09 at 19:22:52

Title: int test; test=!0?
Post by Titus on 05/07/09 at 19:22:52
Dear Barragan,

I tried this:

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

void loop()
{
 int kan;
int kant;
Serial.println(kant);
Serial.println(kan);
delay(1000);
kant=5;
}

result:
1000
4351


Apparently int test;
doesn't set test to 0?
changing the kant=5; line to kant=3; doest do anything(as expected)

Could you either confirm this or explain why it's not set to 0?
The compiler?

Please check kars' topic on i2c write value to register out aswell, as for my topic on the serial monitor.

Thank you very much

Titus

Title: Re: int test; test=!0?
Post by barragan on 05/08/09 at 18:56:30
have you tried:

Serial.println(kant,DEC);
Serial.println(kan,DEC);
let me know.

Title: Re: int test; test=!0?
Post by Titus on 05/09/09 at 10:55:12
I just tested it, it printed 0 ;)

Also I tested the following

int kan=0;
int kant=5;
kant=kant+kan;
Serial.println(kant);
Serial.println(kan);
delay(1000);


Which resulted in
5
0

So I think the fact that it didn't print zero in my first program, is due to the serial monitor.
The variables are set to 0.
Thanks!

Wiring Forum » Powered by YaBB 2.5 AE!
YaBB Forum Software © 2000-2010. All Rights Reserved.