Home \ Help \ Search \ Login RSS

Welcome, Guest. Please Login

This forum is now READ-ONLY! Please visit http://forum.wiring.co/ for the new forum.

Wiring ForumProgramming Questions & HelpPrograms › int test; test=!0?

Page Index Toggle Pages: 1
int test; test=!0? (Read 4194 times)
05/07/09 at 19:22:52

Titus   Offline
Full Member
Wiring Soccer Robot!
Amsterdam

Posts: 176
***
 
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
 

Check www.TeamVossius.nl for our Autonomous soccer robots!
IP Logged
 
Reply #1 - 05/08/09 at 18:56:30

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
have you tried:

Serial.println(kant,DEC);
Serial.println(kan,DEC);
let me know.
 
IP Logged
 
Reply #2 - 05/09/09 at 10:55:12

Titus   Offline
Full Member
Wiring Soccer Robot!
Amsterdam

Posts: 176
***
 
I just tested it, it printed 0 Wink

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!
 

Check www.TeamVossius.nl for our Autonomous soccer robots!
IP Logged
 
Page Index Toggle Pages: 1