3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Hack your usb missile launcher into an "Auto-aiming autoturret!"

Step 5Programming part 2: Shooting a missile

The following lines of code will take care of the Shooting mechanism.
Now at the end of the script add this:

wiimote.Led1=wiimote.dot1vis
wiimote.Led2=wiimote.dot1vis
wiimote.Led3=wiimote.dot1vis
wiimote.Led4=wiimote.dot1vis


This will make the LEDs on the wiimote light up whenever it can "see" an infrared light. This makes it easier for you to see if the wiimote receives any IR signal.

Now we are going to add the shooting.
This is going to be a little more complex than the previous lines of code, but i hope you understand it. At the end of the script add the following:

if wiimote.dot1vis=true then {
if wiimote.dot1x>412 and wiimote.dot1x<612 and wiimote.dot1y>412 and wiimote.dot1y<612 then {
keyboard.Enter=true
keyboard.Enter=false
}
}


The first line checks if the wiimote can "see" any IR signal. The 2nd line checks if the IR light is in the center of the wiimotes "field of view". If it is, the launcher should be aimed correctly, and the launcher will shoot a missile. If your missile launcher software does not use Enter for firing the missiles, you should change "keyboard.Enter " to whatever key your software uses.
« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
1
Followers
2
Author:toelle