Help with my project!

Discussion specific to projects ideas and support.
rrratier
Posts: 6
Joined: 02 Dec 2011, 20:23

Help with my project!

Post by rrratier »

Hi, i'm Rafael Ratier and i'm from Brazil
I can't program my LEGO Mindstorms to do what its written above

I want to do this:

A menu with 3 opitions:

2000, 4000, 8000
Starting with 8000, if we press the right NXT button it will become 2000, and if we do it again it will become 4000. One more time it will me 8000 again. Starting with 8000, if we press the left NXT button it will become 4000 and if we de oit again it will become 2000. One more time, if we press the left button it will be 8000 again

It's a loop with 3 opitions. Choose one and press Orage NXT Button
Once you have pressed the Orage Button, the cauculator starts

For exemple, you choosed 8000. Now each time you press the right button it will become 8050, 8100, 8150... If you press the right button you'll add +50 to the orignial Number. The same heapens with 4000 and 2000 ( 4050, 4100,4150.....2050,2100,2150.....)

And also, each time you press the left button it will become 7950, 7900, 7850... If you press the left button you'll subtract -50 to the orignial Number. The same heapens with 4000 and 2000 ( 3950, 3900,3850.....1950,1900,1850.....)

http://answers.yahoo.com/question/index ... 708AAdn8Du

The idea is to do a YGO!DuelDisk
inxt-generation
Posts: 290
Joined: 03 Oct 2011, 00:06
Location: Gallifrey
Contact:

Re: Help with my project!

Post by inxt-generation »

What programming software are you using? What exactly do you need help with? Is this project school related? What's a YGO!DuelDisk? Sorry about all the questions, but the better you describe the problem, the more help you'll get.
A.K.A. NeXT-Generation.
"A kingdom of heaven for RobotC now has recursion!"
rrratier
Posts: 6
Joined: 02 Dec 2011, 20:23

Re: Help with my project!

Post by rrratier »

inxt-generation wrote:What programming software are you using? What exactly do you need help with? Is this project school related? What's a YGO!DuelDisk? Sorry about all the questions, but the better you describe the problem, the more help you'll get.
The software that cames with NXT 2.0, the "LEGO MINDSTORMS NXT 2.0"

That's an Yu-Gi-Oh! Duel Disk:

http://www.google.com.br/imgres?q=YGO!D ... 29,r:1,s:0

I just need a calculator. The disk itself i have already built.
No, it has nothing to do with school.

I need help to do a kind of a calculator that subtracts or adds 50 to the original number. This "original number" could be 2000, 4000 or 8000 (the owner of the LEGO Mindstorms could choose how many Life Points the caulculator begins). When the owner of the NXT 2.0 press the right button, it's +50. When the owner of the NXT 2.0 press the left button, it's -50. So if I choose 4000 to start and if I press 5 times right, I'll add 5x50=250 to the original number and the NXT screen will display not 4000 anymore, but 4250.

I think that I can't explain better than this. I'm from Brazil and my English is not so good to explain it as well as I can explain it in my motherlanguage
inxt-generation
Posts: 290
Joined: 03 Oct 2011, 00:06
Location: Gallifrey
Contact:

Re: Help with my project!

Post by inxt-generation »

The flowchart for that code would look something like this:

Code: Select all

Loop until enter button clicked
{
  if right button clicked:  multiply number by 2
  if left button clicked:  divide by 2
  display number
}

Loop until enter button clicked
{
  if left button clicked:  subtract 50 from number
  if Right button clicked:  add 50 to number
  display number
}
To start with the selections "2000", "4000", and "8000", the "number" variable would have to start with the value of 4000. Make sure you select the "click" option in the loops so that it waits for you to release the button before moving on.
A.K.A. NeXT-Generation.
"A kingdom of heaven for RobotC now has recursion!"
rrratier
Posts: 6
Joined: 02 Dec 2011, 20:23

Re: Help with my project!

Post by rrratier »

inxt-generation wrote:The flowchart for that code would look something like this:

Code: Select all

Loop until enter button clicked
{
  if right button clicked:  multiply number by 2
  if left button clicked:  divide by 2
  display number
}

Loop until enter button clicked
{
  if left button clicked:  subtract 50 from number
  if Right button clicked:  add 50 to number
  display number
}
To start with the selections "2000", "4000", and "8000", the "number" variable would have to start with the value of 4000. Make sure you select the "click" option in the loops so that it waits for you to release the button before moving on.
Ok, but i didn't understand 2 things

First of all I don't know how to do it in the program. I don't know houw to use the Mathe and Variable Blocks. I don't know much about plugs too
Seconde:

I understood the loops, but if I do that, and choose 2000, 4000 or 8000, would the second loop start the addiction or the subtraction with the number i choosed? Because I think that it will not do it. I thnk that, that way no matter what number I choose to start with, the addiction or the subtraction will only work with 1 initial number

but i can be wrong.
Could you make it and take a print screen for me? Or explain me more about Math Block?
I would be grateful for your help, it would be so nice of you
inxt-generation
Posts: 290
Joined: 03 Oct 2011, 00:06
Location: Gallifrey
Contact:

Re: Help with my project!

Post by inxt-generation »

I have attached the first part of your program. It demonstrates the concept of wires, variables, and simple menus. The program is commented so you know whats going on. You can reuse it with modifications for the second part.
Attachments
rrratier program help.rbt
This is the first part of your program.
(861.04 KiB) Downloaded 370 times
A.K.A. NeXT-Generation.
"A kingdom of heaven for RobotC now has recursion!"
rrratier
Posts: 6
Joined: 02 Dec 2011, 20:23

Re: Help with my project!

Post by rrratier »

inxt-generation wrote:I have attached the first part of your program. It demonstrates the concept of wires, variables, and simple menus. The program is commented so you know whats going on. You can reuse it with modifications for the second part.
Thanks a lot!!!!!!! I'll see what I can learn with it and I'll let you know if i made my program how I want
rrratier
Posts: 6
Joined: 02 Dec 2011, 20:23

Re: Help with my project!

Post by rrratier »

inxt-generation wrote:I have attached the first part of your program. It demonstrates the concept of wires, variables, and simple menus. The program is commented so you know whats going on. You can reuse it with modifications for the second part.
Ok, I understood. I think I can do the second part by myself
But I need to understand just 2 more things:

When I press the left button when i'm in 8000, nothing heapens, but when I press the left or the right button in 4000 or 2000 it chances. 4000 can be 2000 or 8000, 2000 can be nothing ( if left button is pressed ) or 4000 again and 8000 SHOULD be nothing ( if pressed the right button ) or 4000 again, if pressed left button
When i'm in 8000, the only button that's work it's the orange button. How can it be fixed?

And the other questions is:

How can I make a choise in the menu that you created? When I press Orage Button the program ends. i'll do by myself the second part but.... the second part should start with 2000 if I press Orage Button when 2000 is selected and the same should heapens when I select 4000 or 8000 and then press the Orange Button. How can I do this effect?
inxt-generation
Posts: 290
Joined: 03 Oct 2011, 00:06
Location: Gallifrey
Contact:

Re: Help with my project!

Post by inxt-generation »

I fixed the selection problem. To add and subtract from the number you selected, just use the "Number" variable again. You can use variables anywhere in your program, and access the data they carry anytime.
Attachments
rrratier program help.rbt
(966.46 KiB) Downloaded 344 times
A.K.A. NeXT-Generation.
"A kingdom of heaven for RobotC now has recursion!"
rrratier
Posts: 6
Joined: 02 Dec 2011, 20:23

Re: Help with my project!

Post by rrratier »

inxt-generation wrote:I fixed the selection problem. To add and subtract from the number you selected, just use the "Number" variable again. You can use variables anywhere in your program, and access the data they carry anytime.
I DID IT
JUST HOW I WANTED
THANKS A LOT

When I have everything fineshed i'll send the program, the foto and the videos from my project

It would be better if the numer position were like this
http://img841.imageshack.us/img841/1328 ... rick11.jpg

or like this:
http://img7.imageshack.us/img7/7515/blacknxtbrick1.jpg

Is that possible?
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests