Counting
-
- Posts: 2
- Joined: 02 Oct 2010, 15:38
Counting
I'm practically a beginner, I have been learning to use the more advanced blocks in NXT-G , and I just have a question. I was trying to program a robot that would count. I wanted it to display 0 on the screen and every time I pressed the touch sensor it would add one. I know how to put the numbers on the screen, so can someone just help me with the touch sensor and the adding one? Thanks!
-
- Posts: 2
- Joined: 02 Oct 2010, 15:38
Re: Counting
Oops... I just realized I should have put this in the projects section. Sorry. But can I still have help?
Re: Counting
This forum is fine. Projects is more for finished stuff
As for your question, I can really recommend you take a peek at the wonderful tutorials on this site: http://www.ortop.org/NXT_Tutorial/ . You're going to want to pay particular attention to the part about reading sensors inputs, loops and variables.
- Xander
As for your question, I can really recommend you take a peek at the wonderful tutorials on this site: http://www.ortop.org/NXT_Tutorial/ . You're going to want to pay particular attention to the part about reading sensors inputs, loops and variables.
- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
Re: Counting
Follow Xander´s suggestion. You'll lean a lot of useful and interesting stuff.
To get you on the way with your program in NXT-G, first off, you need a place to do the counting: a variable - starting it with a zero value (you can configure that in the variable block config panel) would be a good idea.
Then you need to have a loop that waits for the touch sensor to be bumped (pressed and released) before it will add one (with a math block) to the value of the variable and refresh the screen to show the change.
As you can see, writing down step by step what you want the program to do is half the job done
To get you on the way with your program in NXT-G, first off, you need a place to do the counting: a variable - starting it with a zero value (you can configure that in the variable block config panel) would be a good idea.
Then you need to have a loop that waits for the touch sensor to be bumped (pressed and released) before it will add one (with a math block) to the value of the variable and refresh the screen to show the change.
As you can see, writing down step by step what you want the program to do is half the job done
Who is online
Users browsing this forum: Semrush [Bot] and 0 guests