6

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.

4
  • Are you setup to use NQC?
    – pcantin
    Dec 10, 2012 at 19:22
  • no, I have to use RCX Code
    – Ewelina
    Dec 10, 2012 at 19:24
  • 3
    Please state clearly what problems you have as well as what you have tried.
    – Ambo100
    Dec 11, 2012 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, 2012 at 2:59

1 Answer 1

6

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

1
  • @ewelina does this help in any way?
    – pcantin
    Dec 18, 2012 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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