Take the 2-minute tour ×
LEGO® Answers is a question and answer site for LEGO® and building block enthusiasts. It's 100% free, no registration required.

I just build the RCX Gunner Bot using the instructions from this web site.

I had to build something different to the one we built in the class, I added a touch sensor and light sensor, so the bot will avoid any obstacles on its way, and shoot when it sees a black dot.

I am wondering if anyone has a program for a basic gunner bot, or at least for shooting the bullets. If somebody can help me, It would really appreciated. I am not an engineering person but I need to pass that class.

share|improve this question
    
Are you setup to use NQC? –  pcantin Dec 10 '12 at 19:22
    
no, I have to use RCX Code –  Ewelina Dec 10 '12 at 19:24
3  
Please state clearly what problems you have as well as what you have tried. –  Ambo100 Dec 11 '12 at 16:20
    
I used: ON motor B then Set Direction Bv then Set Power B(8) and the bot is shooting but non stop. How to make it drive then shoot two times if it hits something or shoot if it sees a black spot? –  Ewelina Dec 12 '12 at 2:59
add comment

1 Answer 1

Your code handling the behaviours like "Shoot 3 times if the touch sensor is triggered" or "Shoot if the light sensor is triggered" should use 'if' statements.

enter image description here

Then, instead of always being called, the "shooting" code would append only on sensor events. After shooting, the robot would then go back to the "Driving around" part of the code.

This page is a good visual reference for all the RCX programming components

share|improve this answer
    
@ewelina does this help in any way? –  pcantin Dec 18 '12 at 14:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.