Go Down

Topic: returning from a statement (Read 969 times) previous topic - next topic

Boffin1

I know  999 , I thought I would go out on a bang with a confused posting!  

I have been up since 3am trying to get the rough idea of this sketch together, and I get my functions and statements mixed up at the best of times :-(

I havnt actually written anything yet, apart from some of the subroutines   er I mean functions :-)

Basically does an if statement return to the part of the sketch immediately after the statement ( in other words to the first line that would have been if the statement was false ) ?

and if I use "else"  ( and the statement is true ) would it rather return to the first line after what it would have run had the statement been false ?

If this doesnt make sense I will write a bit of sample code to try / post.
With my mobile phone I can call people and talk to them -  how smart can you get ?

Nick Gammon

An "if" doesn't really go anywhere, so seeing your code will help answer your question.

Nick Gammon

Quote
Posts: 1000


Congrats on becoming an Edison member!

Boffin1

Thanks Nick,    Edison is very confusing with simple code !

I will post somethng when I have got it written ( if I am still confused )  perhaps half an hour on the stoep on my hammock will help :-)
With my mobile phone I can call people and talk to them -  how smart can you get ?

Boffin1

#9
Jan 30, 2013, 10:36 am Last Edit: Jan 30, 2013, 10:38 am by Boffin1 Reason: 1
So now I start to write a test using blink in the background to make sure its running :-

Code: [Select]


// int timing = LOW;
//int vtState = LOW;
int number  ;

void setup() {                
 number = 2;
 pinMode(13, OUTPUT);  
Serial.begin(9600);  
 Serial.print(' number =  '); Serial.println(number);
}

void loop() {
 digitalWrite(13, HIGH);   // set the LED on
 Serial.print(' number =  '); Serial.println(number);
 delay(1000);              // wait for a second
 digitalWrite(13, LOW);    // set the LED off
 delay(1000);              // wait for a second
}


and when I run even this, the serial out on the monitor ( at 9600 ) just shows 82242 every second,  with no text , even in setup.

The LED is blinking OK so the chip is OK.

Edison looks like its going to be interesting ............

With my mobile phone I can call people and talk to them -  how smart can you get ?

Go Up