Pages: [1] 2   Go Down
Author Topic: Ussing the togo command or creating subroutines  (Read 1245 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
God Member
*****
Karma: 39
Posts: 988
Get Bitlash: http://bitlash.net
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

-br
Logged

Malaysia
Offline Offline
Sr. Member
****
Karma: 7
Posts: 393
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 308
Posts: 26455
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

"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.

Poole, Dorset, UK
Offline Offline
Edison Member
*
Karma: 52
Posts: 2359
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Mark
Logged

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

"GOTO considered harmful" is considered harmful

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

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 495
Posts: 19020
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Flogging Considered Harmful.
Logged


UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 308
Posts: 26455
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

(Tom) Duff's Device
Logged

"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.

Offline Offline
Edison Member
*
Karma: 33
Posts: 1462
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

I only provide help via the forum - please do not contact me for private consultancy.

Offline Offline
God Member
*****
Karma: 19
Posts: 785
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Temple, Texas
Offline Offline
Sr. Member
****
Karma: 14
Posts: 361
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Cheers,
John
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 495
Posts: 19020
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Pages: [1] 2   Go Up
Jump to: