can you help me?

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
aarnau
Posts: 14
Joined: 10 Dec 2011, 11:21

can you help me?

Post by aarnau »

Hi, I'm trying to create a program for a robot that never falls down of a table.
I have done it but I have a problem. I want the robot to move with a random movement, by logic in the direction.
So, the problem is that I want the robot to one time turn left and maybe the other turn right, or not. Make it by chance.
I don't know how to do it, could you help me, please?

thankyou and sorry for my bad english! TT
pbenco
Posts: 71
Joined: 29 Sep 2010, 09:43
Contact:

Re: can you help me?

Post by pbenco »

hello dear aarnau

We need more informations in order to help you.
First of all, give your code, well documented if possible, in order for us to understand where you want to introduce some random, AND say what programming env. you're using!
Second of all, give us some photos of your project, to bring us more informations with your difficulties. (Not to mention that we need more pictures here, to make this forum more attractive and inspiring :lol: )
Looking for your answer, best regards
Ben
pbenco.wordpress.com/
aarnau
Posts: 14
Joined: 10 Dec 2011, 11:21

Re: can you help me?

Post by aarnau »

Hi I am new in this web and I don't understand what code mean here. What do you want me to do?
I am using NXT 2.0 when I am programming and my robot is a simple building robot, like a explorer more or less.
I also don't know how to attach a photo here, how can I do it?

My question is not to solve my program, I only want to explain me if I can make the robot turn left or right by chance, in a forever loop. So, some times it will turn left and the others it will turn right.
Thankyou.
pbenco
Posts: 71
Joined: 29 Sep 2010, 09:43
Contact:

Re: can you help me?

Post by pbenco »

OK aarnau
I understand you are programming the NXT kit with the graphical programming environment provided by LEGO, NXT-G.
You have in NXT-G A random generator, the block with a dice on it, http://www.legoengineering.com/knowledg ... ock+for%3F

You can configure it easily:
Range: is for setting min and max values desired, min and max included.
Drag the Value # to connect everywhere you want... it delivers a numerical value, so you can use math to scramble your direction choice... Or use a switch block to bring some unpredictable behaviour.
please refer to the help of random and switch blocks...

Hope this help
Ben
pbenco.wordpress.com/
aarnau
Posts: 14
Joined: 10 Dec 2011, 11:21

Re: can you help me?

Post by aarnau »

ok thankyou I have program it a little bit different but It works. I only have to try it in the whole program, and I'll say if it works or not.
thankyou for the help
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests