Ussing the togo command or creating subroutines

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.

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

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

-br

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

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.

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

Mark

"GOTO considered harmful" is considered harmful

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

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

Flogging Considered Harmful.

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?

(Tom) Duff's Device

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.

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

That's the lad. It still makes my head hurt, even after all these years.

seag2013: 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.

These are very good articles/resources about goto's. http://www.stevemcconnell.com/ccgoto.htm http://c2.com/cgi/wiki?GotoConsideredHarmful

Cheers, John

seag2013: 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.

To be fair, I don't recall a goto in Duff's Device, but it seemed to fit the description.

Togo is between Ghana and Benin in West Africa, if that's what you're looking for. 8)

It uses a switch/case:

register n = (count + 7) / 8;   /* count > 0 assumed */
    switch (count % 8)
    {
    case 0:    do { *to = *from++;
    case 7:     *to = *from++;
    case 6:     *to = *from++;
    case 5:     *to = *from++;
    case 4:     *to = *from++;
    case 3:     *to = *from++;
    case 2:     *to = *from++;
    case 1:     *to = *from++;
              } while (--n > 0);
    }

I want to use my Tft touch shield. I need to hold the pages on the screen and perform interactive activities like reading my PIN or starting a motor using the buttons that I will create on that page, is it possible? and if anyone can help?

If (x > 400)

{
goto Temp;
}

Temp:

// new code

Can this work outside the first void loop () and remain there.