Go Down

Topic: Ussing the togo command or creating subroutines (Read 1 time) previous topic - next topic

seag2013

Hi I'm new with Arduino and I'm using the TFT touch shield from Seeed studio.

I want to be able to go to different parts of my program like creating subroutines " pages"  on my touch screen.  on each page I want to  control or receive inputs from different devices.  I'm trying the togo command it works only to one page but as I add a another page  it sometimes go to the correct page  or to the other  page.  what is the best way to move to a section of a program and work there, without  going back until I want to.

billroy

Perhaps this article on how to write C functions would be helpful:

    http://cplus.about.com/od/learningc/ss/clessonsix_2.htm

-br

ash901226

maybe what you could do is the use the switch statement...

AWOL

Quote
I'm trying the togo command

It's "goto", and should only be used when you really know what you're doing.
Try to pretend it doesn't exist.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

holmes4

Anyone using goto's in ther code should be flogged!.

Mark

tuxduino

"GOTO considered harmful" is considered harmful

http://www.codinghorror.com/blog/2007/10/id-consider-that-harmful-too.html

Nick Gammon


Anyone using goto's in ther code should be flogged!.


Flogging Considered Harmful.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

PeterH

What's the name of that construction which uses goto and a switch to do a non-word-aligned memory copy? I remember that after I eventually figured out what it was doing, it felt like it shouldn't have been allowed but obviously was. I've been wracking my brain trying to remember the chap that it was named after, but it's not coming to me. Anyone remember?
I only provide help via the forum - please do not contact me for private consultancy.

AWOL

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

KeithRB

As Duff himself said:
This code forms some sort of argument in that debate [about C's fall through behaviour], but I'm not sure whether it's for or against.

seag2013

Sorry its goto... My bad... Nobody has anything?

PeterH

That's the lad. It still makes my head hurt, even after all these years.
I only provide help via the forum - please do not contact me for private consultancy.

Delta_G


Sorry its goto... My bad... Nobody has anything?


All I have is that if you are using C++ and you think you need a goto then you are doing something wrong. 

Maybe explain what you want it to do and let these guys help you find the right way which I can guarantee won't have a single goto.

johncc


Nick Gammon


what is the best way to move to a section of a program and work there, without  going back until I want to.


Call a function (subroutine) and not return until you want to.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Go Up