Mousey Junkbot light emitters

Hello there, When I check my IR light emitters, they are giving a different voltage, 3.5mV and 0.8mV. Do they need to be giving a similar value for the eyes to function properly? Also these values are much lower than the 0.6V quoted in the instructions. Any advive would be much appreciated.

Posted by LeonR 8 years ago


IR (infrared) "motion detector" of sorts, need help please

I am looking to build a sort if motion detector that works with 2 IR emitters, 2 IR receivers and a motor, the emitters and receivers would be  in 2 seperate circuits and lined up with eachother  (the emitters constantly on) and when the link to the receivers was severed (for example by someone standing between the emitter and receiver) the motor would rotate, if the left emitter-receiver combo was disrupted it would apply positive voltage to the motor and if the right emitter-receiver combo was dusrupted it would apply negative voltage, is this even remotely possible? Firezone

Posted by firezone 9 years ago


IR Robot Control

The cheapest way of wirelessly controlling a robot is IR, right? I'm in need of help for a schematic for an emitter and a reciever (this will be my first IR project). Please don't tell me to google it because I've been looking around and all I've found were vague schematics. I'd probably want to use a 555 timer for the emitter, but the schematics were vague again. For the reciever would I have to use 4, along with 4 emitters to drive 2 motors independently? As in Motor1 front and back, Motor2 front and back?

Posted by guyfrom7up 10 years ago


sound emitter

i need to know how to make a circuit the will emit sound with levels as high pitched as a dog whistle i been looking around but i can't seem to find one which allows you to control the frequency along with the pitch and tone i'd appreciate any advice and or help on this along with any information leading to any good instructables on here that fit the discryption thank you to every who gives the feed

Posted by maskofdarkness22 7 years ago


Translating a Schematic to a Circuit Board

I need help translating this schematic to a circuit board. As in which rows to place what due to emitters and bases. I'm new at this, please help.

Posted by dwatord26 8 years ago


Would this schematic work?

Will this work? it's based on https://www.instructables.com/id/SCYCBXQFD80BUXI/Basically, what it should do, is when I aim the IR emitter (TV remote) at it, it'll go off for a few seconds. The goal is to hide it and piss off whoever is watching TV, and changing channels.

Posted by cvxdes 10 years ago


What to do with old robot? / Cybot

I found an old robot that was part of one of those 'build it yourself' magazine series. I was gonna eBay it but found there was actually quite alot of cool stuff in there so I've compiled a list and I'm gonna make an instructable using some of the parts, But I need ideas / help.Here are (the best) parts.2x sets of ultrasonic emitters / receivers2x LDRs large2x smaller photoresistors (used for line following)2x set of inrfa red emitter& reciever leds2x bright white leds + various others2x 9v motors & gear housingsLCD display 5cm squreeepromspeed controllers selector switches etcand a load of pre programmed processors that can't be reused.some more technical details here

Posted by madmanmoe64 10 years ago


InfaRed (IR) Motion Sensor

So...If I buy an IR Emitter LED and an IR Receiver LED ...and put them face to face...and get power to each of them....Can I somehow create a motion sensor out of that? For example, if someone walked between the 2 LEDs, it would trigger lights to go on. Is that possible?

Posted by Joe426 10 years ago


High Power LEDs

I have 3 10 watt LED emitters to sell (2.9 cm x 2.0 cm x 0.3 cm) Colour temperature is about 6000K I'll ship anywhere in Australia I don't have a good quality camera right now Send me a private message and I'll see what I can do

Posted by .Unknown. 6 years ago


Calculator IM

At my school we are required to have these TI-83 plus calculators for math. Of course we have classic games and stuff that we put on there, but we want to try to put an infrared emitter and detector on it so we could send IM's within the room to each other. Kinda like texting. Could anyone help us by suggesting ways to do this?

Posted by Jordo 10 years ago


Triggering a flash circuit with a voltage pulse across a transistor

Hi All,        question from a newbie. I'm working on a project for my (steampunk) daughter. For part of it I've taken the flash circuit from a disposable camera (PDF 1:Flash+MechanicalTrigger). This works just fine when I close the trigger mechanically. What I want to do is trigger it with the same pulse (from a 555 timer) that I'll be using to do other things at the same time. To this end I added a transistor as shown in PDF 2:Flash with transistorTrigger. My intention is to feed the 555 pulse to base, saturating it and triggering the flash. Result, abject failure. Help! The proposed triggering transistor is an MJE340(NPN). When set up as shown the indicator LED glows but voltage across Emitter-Base produces no result. When testing I noticed that if I mechanically make the collector-transformer connection it triggers a flash, even with no voltage across emitter-base. I'm stumped. Any ideas very gratefully accepted. Thanks, Fred.

Posted by fredstein 6 years ago


Wanting to make a switchable IR night light

Every night I come home, I have to open my garage door manually and park my motorcycle. When the garage closes, its dark and I tend to bump into my cycles exhaust burning myself. Yeah pretty funny. Anyways I had an idea, since I already had an arduino uno board and an IR Sensor and emitter, I wanted to make a trigger-able light switch. But I wanted my IR reader to run on AC, like a night light. At the press of a button from my emitter, the IR would pick up the codes and my light would turn on. Is this possible? Some people say, just buy a motion sensor and plug it in, I say i'll just salvage it for parts and try to make my own. Whats the fun in buying it, when I could build it with parts I already have. I mean, I know AC is dangerous, if not viable, then I could resort to a 9v with a power capacitor so long as it doesn't drain my 9v instantly.

Posted by bprins 3 years ago


High Voltage Amplifier

I am trying to build a high voltage amplifier that will amplify an AC signal of approx. +-5V to a signal of approx +-100V.  I was looking into building a common-source amp using JFETs or a common-emitter amp using BJTs, but both seem to have an output waveform of 0V to +100V.  Is there a way to modify these amps to have an output waveform of -100V to +100V?   Also, if anyone has any better Ideas, please let me know. Mark

Posted by questionmark05 8 years ago


Help

I need some help translating this diagram to a small printed ciruit board I bought from radioshack. I've never done this before and wish to learn. I decided to build this lie detector for my science class science fair project and have all the necessary equipment, I just dont know like what row to put what and emitters, base, and all that good stuff. Please help. Thank you.

Posted by dwatord26 8 years ago


Transistors are best for melting brains!!

I have been experimenting with transistors for 3 days now, both NPN and PNP. So far I have concluded nothing. I figure the easiest thing to do is to make a transistor work as a switch. With the NPN, the current seems to flow from the base to the emitter automatically. My understanding is that current should flow from the collector + to the emitter- only when I apply voltage +? to the base, is that correct? I don’t even need to connect the collector on the NPN and current flows. I have also read a million things about transistors online. My experiments seem to disprove most(all?) of the findings. This leads me to one conclusion. I’m not doing something right. Maybe I don’t have the right transistors. I have no idea. I have been using radioshack NPN’s (276-2016) and PNP’s (276-1604) When it tried to make a switch with a PNP my voltages was going back through my emitter to ground. If I disconnected it the system(test led) no longer worked. You might need to know that I was using a 5v voltage regulator to supply a 10v 5v and ground leads for my experiments. I was getting odd voltage readings on my circuits so I put diodes on the leads. The diodes stopped my PNP from working(I figured the current was flowing odd ways…back in the 5v+?) and didn’t seem to effect my NPN experiments. So I figure I’m closer on my NPN’s than my PNP’s. I wish I could explain better but my brain is about to melt. My wife is mad at me because I am obsessed with making this work… please help :P

Posted by kendallickes 9 years ago


Palm Universal Wireless Keyboard disassembly?

I'm toying with the thought of adapting my Palm Universal Wireless Keyboard to work with Bluetooth.  Currently, it sends irDA data at 9600 baud.  This should be decodable using an xmega's usart which has an irDA mode.  One could even bypass the IR emitter, as there are exposed contacts in the base where one can catch the signals prior to irDA transmission (at 1.5V high  / 0.5V low levels). My question is: Does anyone know how to disassemble the keyboard?  I don't see any screws anywhere.

Posted by arpruss 4 years ago


Basic circuitry help? [not yet resolved]

(I wasn't sure if this should be a comment on the Instructable or not, as it is a bit long, and I have some pictures..) I am following a sound-reactive LE 1.D tutorial and having a bit of trouble. The circuit consists of a SPDT switch, resistor, LED, transistor, and a 3.5mm stereo jack. When I play music using this stereo jack, I get no response from the LED. I'm trying to make something on a breadboard for the first time, so I'm thinking maybe I'm missing something because of that. Here's how the machine is supposed to work: - Positive charge flows to SPDT switch, and if it's in the correct state, continues to the 150 ohm resistor - Anode of LED is connected to the resistor, and the cathode is connected to the "emitter" lead of a TIP31 transistor ("base" is wired to the power bus) - The "collector" lead of the transistor is attached to one of the outputs on the stereo jack - The ground wire on the stereo jack returns to the common lead of the SPDT switch. Perhaps I wired something wrong? I've included pictures if the description is not sufficient. EDIT: I've modified the circuit a bit - maybe I can take pictures / draw a diagram tomorrow. Now, here's how it works: - Positive charge flows from positive side of the power bus to the "base" lead of the transistor - Collector lead of the transistor is connected to the left-channel lead of the stereo jack (also, the ground pin of the stereo jack is connected to the negative side of the power bus) - Emitter lead of the transistor is connected to a 150-ohm resistor - Resistor is connected in series with two LEDs - The cathode lead of the second LED returns to the negative lead of the power bus The LEDs do turn on now, but that's the problem - they are always at full brightness no matter the volume of the music. Even if no music is playing, the LEDs are fully lit. I've used a multimeter to check what's happening, and after pressing the negative lead of the multimeter to the cathode lead, and the positive lead to the anode lead, it shows a constant voltage of 1.986 V. I don't understand how this isn't working - I've verified that the collector lead is correctly connected to the left-channel wire... maybe I should try the right channel? Or a different cable? tl;dr: Rewired and the LEDs are always at full brightness. Transistor doesn't seem to be affecting the emitter output, for some reason..

Posted by hansengel 9 years ago


Transistor

I would like to know if someone could draw up a small circuit using  a TIP3055 as a switch for these led lights,Im running these off a small circuit for a pir sensor, that uses a relay, and i want to use a Transistor or a mosfet  because of size. I just cant do the math for the cir.here are the spec. for the led lights."Working input voltage :12vdc working power 36W . working current 5 amp I know that you have to feed the Base with a lower voltage, and the emitter goes to ground, and the collector get the 12vdc. tks for the help. I never was good at algebra in school, don't even remember it,  ha ha ha

Posted by conntaxman 5 years ago


Mouse IR detector Challenge

Anybody know how to determine which legs are which on the IR detector (double transistor) in old-school mice? One leg is common and the other two legs are emitters. Is there a test I can perform with a needle type VOM that could identify the leads? These three legged components are very common and can be used to build really simple and cheap data acquisition of rpm using the microphone jack and 5 volts from a USB port. One leg has extra metal and is likely the common. Still I would like to know if anyone has a test procedure. Thanks to all and keep repurposing everything in your path. It just feels good.

Posted by nickec 11 years ago


Need pre wired high power leds

I am in need of a pre wired High Power Led board. Something like a Cree XR-E Q2 Emitter. I would like to find a supplier that I could buy pre built/ wired boards (plug and play) to install in a small lighting package. Ideally I would like to find a pre built light that I could incorporate into my project. I need a high output 12v white light, that I can make a reverse light out of. I am hoping to market the product so a supplier over a retail option would be best. Any help you could give would be greatly appreciated Thanks in advance  

Posted by returnforservice 7 years ago


Relay Timer

I am currently engaged in a project where i need to create a count down timer relay controller. i was thinking of using a digital alarm clock as part of my goal is to have the display visually counting down, but i don't know of any that have a count down feature. i want the timer to power a relay to turn a string of IR emitters on for several seconds. i have a digital kitchen timer that counts down, but im not sure if it will work. i would like to use the power to the buzzer to activate the relay but there is no stable current there, it only Emits several beeps in quick succession(when i meter it, it comes out to about . volts). this is why the alarm clock would be better. i was hoping to use an electromechanical relay but i don't think it will work. does anyone know of another relay that will trigger with this kind of input?

Posted by gedion4000 9 years ago


I have a question about My ROV control system.

I am building an ROV and I need to know whether this control board will work. I planed on Running 1 Cat5 and 1 set of speaker wires to control and run systems on-board. When I flip a switch on the control panel, a 3v signal is sent down the Cat5 wire to the base of a transistor, which opens the flow of power between the Emitter and collector. My main question is, does a transistor work as a switch? Example. A signal enters the Base and opens the other two connections. Is this right? Oh, and the other two pictures are what i plan for it to look like. I am building it using the motors from one project (posted recently) , the frame another, and my own control. I will post an instructable as soon as it is done.

Posted by ry25920 10 years ago


Thermal Flashlight scaling help

Hello all, I'm dont have much basic knowledge about electronics and I got a problem. I've built this exact Instructable: https://www.instructables.com/id/Build-a-Thermal-Flashlight-Light-Painting-with-T/?ALLSTEPS I want to drive a 1m RGB LED strip with it so I've changed the NPN transistors to stronger ones that handle 0.5 A, it's the only components that are different. These are the exact NPN transistors: https://www.elfa.se/elfa3~eu_en/elfa/init.do?item=71-014-58&toc;=0&q;=BC337-25 Problem: the circuit works fine with ONE RGB LED but it does not work with even the smallest bit of RGB-strip (3 emitters). Goal is to drive a 1m strip and that consumes 14.4W @ 12V. Im using 12V 1A adapter for the Arduino and another 12V 2.5A for the LED-strip. What am I not understanding?

Posted by ronnlund 5 years ago


How do you make an annoying buzzer?

I want to do a practical joke at work.  I want to use IR LED'S to make a sender and receiver so that when I push my remote it will activate the buzzer, but when I let off of the button, the buzzer will stop. I am assuming that the sending part would be easy, pretty much a battery, button, and perhaps a resistor (and the LED), but how would I make the receiver so it will set off the buzzer? Thanks! Edit: I just went to radio shack and got this emitter and detector: http://www.radioshack.com/product/index.jsp?productId=2049723 I also bought this buzzer: http://www.radioshack.com/product/index.jsp?productId=2062394 I did a quick hookup (with electrical tape).  I used a momentary switch from an old computer for the emitter.  I know it was working because I used my video camera to detect it.   When I pointed it at the detector/buzzer nothing happened.  I was using about 2 volts, (buzzer votage is 1.5-3VDC).  I just went to the site to look up the detector and it says the phototrasistor detector is 20V at 25 mA.   On the package the max is 70 V.   My question, If I use the following configuration, should it work?  I dont want to try this and blow out  my buzzer before I get an opinion.   Thanks I cant seem to get the pic to upload here, so I put it on my site: http://www.gamesfree4u.com/detectorsch.html EDIT: 12/30/09 Well, I bought a breadboard and tried to wire it up.  Not a lot of room on those things.   I used 3 9volt batteries for the receiver.  According to the site, they use from 20 to 70 volts, unless im reading something wrong.  I didnt use any resistors, which I should have.   As soon as I hooked up the power the diode burned up. lol.   Oh well, lesson learned = $1.00.  I'll have to give this  more thought.

Posted by pennsteve 8 years ago


Dirt Cheap Acoustic Guitar Pickup

Hi I am concerned about the health and safety aspects of the instructable of "Dirt Cheap Acoustic Guitar Pickup by Xuthal". The project encourages people to take apart a smoke detector to obtain a piezo sounder. However no warning at all is given by the author that there may be radioactive material in the device, or how to recognise it and how to deal with it. I tried to post a warning on the article but for some reason it hasn't worked. I could not see how to flag up the item so I am posting here. Whilst the manufacturers of smoke alarms play down the dangers of Americium 241 dioxide (the radioactive material), they would most certainly not condone opening up a smoke detector sensor. Am O2 will most likely pass straight through the gut due to its insolubility, so your readers are probably safe from ingesting it. However, if the source is fractured into dust particles, it could be inhaled and will lodge in the lung for a long time. Being an alpha emitter the Am241 will very likely end up causing a lung cancer. I think this instructable is highly irresponsible and should be removed. In any case the item taken from the smoke detector, a piezo transducer, is readily available from any hobby electronics supplier and costs less than the battery to power the detector in the first place!

Posted by TCSC47 3 years ago


Arduino Compatible Component Basic Element Starter Kit

- Great Arduino kit for  beginners. Makes a great basis for a robotics or electronics Instructable. Perfect for kids who want to catch the electronics bug.  - Package includes: 1 x Arduino duamilanove - 1 x Development expansion board - 1 x Mini breadboard - 1 x Breadboard - 1 x Acrylic plate - 1 x LED emitter kit (red / green / yellow; each 5pcs) - 2 x Buzzer - 4 x Push button switch - 2 x Seven segments display - 2 x Mercury switch - 3 x Light dependent resistor - 1 x Adjustable resistor - 1 x Flame sensor - 1 x Infrared receiver - 1 x Resistor kit (200ohm / 1K ohm / 10K ohm; each 10pcs) - 1 x LM35 temperature sensor - 1 x USB cable (48cm) - 65 x Breadboard cable (8~22cm) - 1 x 9V battery - 1 x Battery slot - 1 x Remote control (1 x LR1130 / included) - 2 x Storage case (1-large / 1-small) - 1 x Software CD http://dx.com/p/arduino-compatible-component-basic-element-pack-starter-kit-132807

Posted by GadgetNut 5 years ago


Reefer meets High Power LEDs (looking for help)

Well this is my second post and I am a bit more learned in the ways of LED circuits from many of your posts.Objective: Create a high light output LED array that will peak at around 16,000K for growing coral for reef aquariums.Primary strategy: connect 10 or more Luxeon III stars in seriesPreferred requirements: Energy efficient, Low Heat emittance, Needs to peak out at the appropriate spectrum for the coral ( I have that covered just by changing the ratio of cool whites to royal blue Luxeon III's)At the moment I a just going for a simple on/off, later i would like to employ a form of automated dimming so that it fades on and off so there is not such a sharp on off with the LED's. So far I have a circuit that i plan on modeling my LED array after since it was readily available for me to dissect. The following is an LED array. I know that there is a diode rectifier bridge built in there and a smoothing capasitor but there are to components i do not recognize they are connected at the positive and negative ends of the circuit. One is the Yellow (doohickey with part # 684j 250) component attached to the positive lead and the other is a clear (fuse/resistor hybrid) component next to the resistor on the board.https://www.instructables.com/files/deriv/FGX/D7E2/FBQ33XYA/FGXD7E2FBQ33XYA.MEDIUM.jpghttps://www.instructables.com/files/deriv/FGX/D7E2/FBQ33XYA/FGXD7E2FBQ33XYA.MEDIUM.jpgI was able to draw the circuit and it seems pretty straight forward but I just need to know if I will be able to spec the appropriate components to operate 10 leds in series (Each LED operates with a Vf=3.9 V and I= 1000mA ) they will need a supply of more then 40V DC.Any help or dialogue I can get the more the better and the more I will learnIn addition I looked at Dan's high power constant current but not sure how well it would operate under the conditions that I have specifiedPrimary LED's in use for the Reef light: (note all are stars)LED part # Color Type Vf Amps LuxLXHL-LW3C cool white Lambertian 3.9 1000mA 80lumensLXHL-LR3C Royal blue Lambertian 3.9 1000mA 445mWLumensLXHL-MW1D cool white " " 3.42 350 mA 45 LumensLXHL-MRRD Royal Blue "" "" 3.42 350 mA 220 mWLumensThere was little to no difference between the 700 mA series and the 1000mA series so I did not list themI look forward to all your helpTom

Posted by Aquatope 10 years ago


Reefing it with LED's (help needed)

Well this is my second post and I am a bit more learned in the ways of LED circuits from many of your posts. Objective: Create a high light output LED array that will peak at around 16,000K for growing coral for reef aquariums.Primary strategy: connect 10 or more Luxeon III stars in seriesPreferred requirements: Energy efficient, Low Heat emittance, Needs to peak out at the appropriate spectrum for the coral ( I have that covered just by changing the ratio of cool whites to royal blue Luxeon III's)At the moment I a just going for a simple on/off, later i would like to employ a form of automated dimming so that it fades on and off so there is not such a sharp on off with the LED's. So far I have a circuit that i plan on modeling my LED array after since it was readily available for me to dissect. The following is an LED array. I know that there is a diode rectifier bridge built in there and a smoothing capasitor but there are to components i do not recognize they are connected at the positive and negative ends of the circuit. One is the Yellow (doohickey with part # 684j 250) component attached to the positive lead and the other is a clear (fuse/resistor hybrid) component next to the resistor on the board.https://www.instructables.com/files/deriv/FGX/D7E2/FBQ33XYA/FGXD7E2FBQ33XYA.MEDIUM.jpghttps://www.instructables.com/files/deriv/FGX/D7E2/FBQ33XYA/FGXD7E2FBQ33XYA.MEDIUM.jpgI was able to draw the circuit and it seems pretty straight forward but I just need to know if I will be able to spec the appropriate components to operate 10 leds in series (Each LED operates with a Vf=3.9 V and I= 1000mA ) they will need a supply of more then 40V DC.Any help or dialogue I can get the more the better and the more I will learn In addition I looked at Dan's high power constant current but not sure how well it would operate under the conditions that I have specifiedPrimary LED's in use for the Reef light: (note all are stars)LED part # Color Type Vf Amps Lux LXHL-LW3C cool white Lambertian 3.9 1000mA 80lumensLXHL-LR3C Royal blue Lambertian 3.9 1000mA 445mWLumensLXHL-MW1D cool white " " 3.42 350 mA 45 LumensLXHL-MRRD Royal Blue "" "" 3.42 350 mA 220 mWLumensThere was little to no difference between the 700 mA series and the 1000mA series so I did not list themI look forward to all your helpTom

Posted by Aquatope 10 years ago


Scholarship Submission the Second!

For my next submission for the scholarship Create, I decided to design a robot that would not help what you do in your daily life, but how. Stress can build up without you yourself knowing. Perhaps you're prone to panic or anxiety attacks and can't recognize them; the first step in dealing with such. So, I would develop a robot that could cater to easing your stressed or panicked condition by detecting the symptoms and then using any number of methods to return to you a normal state.For in-home use, the human would wear a combination heart rate/respiration/oximeter monitor (coupled with a BP cuff perhaps) that would send wireless data to a nearby computer or the robot itself. At such time a stressed condition arises, the programming can recognize what course of action is needed and address it. For instance, a raised heart rate and shortened breath with low oxygen absorption could indicate a panic attack. The robot would then stop what it was doing (vacuuming, chastising cats, etc) and find the human. The robot would then playback an audio message of "Are you feeling OK?" or a soothing musical piece or project a slideshow of recognizable images. The robot could return from time to time after an stress event to check on the progress of the human. If the human doesn't return to wellness, a more advanced robot would suggest any number of relief alternatives ("Should you take your medication?") or possibly notify another human of the situation. Of course, this is no substitute for having a companion or caregiver nearby to assist in these situations. I originally had the idea for people that live and work alone, or happen to find themselves without human contact during times of stress. My fiancee then suggested that I expand the scope to more needy people like the elderly that can't or won't always speak for themselves about how they feel. That version may require more resources than I am privy to unfortunately. If I get a chance to work with a Create, I would try to pack in as many features as possible.I would like the robot to have a some kind of visual representation of a face like an LCD and an interface so the human can interact with the robot. Voice recognition would be nice but a simple red and green button may have to do for now. The human would have to wear, in addition to the monitor, an IR emitter of some kind so the robot can find said human. It could be done cheaply with something like a promotional LED light worn on a lightweight anklet or even attached to a shoe. As a footnote, I'd like to say that anytime I'm tense, there's nothing quite like an episode of "Ask This Old House" to calm me down. Hmmm....

Posted by SolamenteDoug 11 years ago


Help for realising a linefollower tankbot

Hello, I want to realize a linefollowing tank bot. I got this following parts: - Arduino Mega 2560 - Arduino MotorShield Rev03 - Pololu QTR-8RC Array - Pololu RP5 Tankchassis (6V DC Motors) Now all parts are together and the code must be completed. Therefore I found a really nice PID-based tutorial for linefollower: http://letsmakerobots.com/blog/enigmerald/pid-tutorials-line-following I create a program, but after calibrating the sensors, the bot doesn't drive on the line. It makes no sense were it drives. Most time it do 90° turns and so on. Do you find a better solution for my code? [code] #include #include   /////////////////////////// // define constants   // /////////////////////////// #define AUTO_CALIB  false      // Autokalibrierung aktivieren #define DEBUG_ENABLE   true               // false=keine Serial Ausgaben #define NUM_SENSORS    8                  // Anzahl der verwendeten Sensoren #define TIMEOUT        2500               // waits for 2500 microseconds for sensor outputs to go low #define EMITTER_PIN    QTR_NO_EMITTER_PIN         // Default: kein Emitterpin definiert #define MOTOR_SPEED    100               // PWM Signal 0-255 (Basismotorgeschwindigkeit) #define MOTOR_MAX_SPEED 255       // PWM Signal für Maximalgeschwindigkeit #define KP     0.2                    // KP-Wert für PID Regler #define KD     5                     // KD-Wert für PID Regler ( Beachte: Kp < Kd) #define SERVO_PIN1  11       // PWM Ausgang für Servo1 #define SERVO_PIN2  12       // PWM Ausgang für Servo2 #define CALIB_LED   13       // LED Ausgang für Kalibrierungsphase ////////////////////////// // define variables     // ////////////////////////// // Zuweisung der Sensoren 0-7 an die digitalen IO's 22-29 QTRSensorsRC qtrrc((unsigned char[]) {22, 23, 24, 25, 26, 27, 28, 29}, NUM_SENSORS, TIMEOUT, EMITTER_PIN); unsigned int sensorValues[NUM_SENSORS]; int MotorLeftSpeed=3;                  // PWM pin for speed control left int MotorRightSpeed=11;                // PWM pin for speed control right int MotorLeftDirection=12;            // digital pin for direction control left int MotorRightDirection=13;            // digital pin for direction control right int MotorLeftBrake=9;                  // digital pin for brake control left int MotorRightBrake=8;                 // digital pin for brake control right int lastError = 0; ///////////////////// // Initialisierung // ///////////////////// void setup() {     // Initialisierung verschiedner IOs   pinMode(CALIB_LED, OUTPUT);    // Definiert LED Ausgang für Kalibierungsphase       // Initialisierung linker Motor   pinMode(MotorLeftDirection, OUTPUT);      // Definiert Ausgang für den linken Motor   pinMode(MotorLeftBrake, OUTPUT);          // Definiert Bremse für den linken Motor   pinMode(MotorLeftSpeed, OUTPUT);   // Definiert Geschwindigkeitsausgang für linken Motor   // Initialisierung rechter Motor   pinMode(MotorRightDirection, OUTPUT);     // Definiert Ausgang für den rechten Motor   pinMode(MotorRightBrake, OUTPUT);         // Definiert Bremse für den rechten Motor     // Initialisierung Servo Motoren   servo1.attach(SERVO_PIN1);     // Zuweisung PWM PIN für Servo1   servo2.attach(SERVO_PIN2);     // Zuweisung PWM PIN für Servo2   if (DEBUG_ENABLE)   {    Serial.begin(9600);    Serial.print("Debug Modus aktiviert:\n");     }     delay(500);     digitalWrite(CALIB_LED, HIGH);    // turn on Arduino's LED to indicate we are in calibration mode   for (int i = 0; i < 400; i++)   // make the calibration take about 10 seconds   {     qtrrc.calibrate();           // reads all sensors 10 times at 2500 us per read (i.e. ~25 ms per call)   } delay(20);      // The 20 ms delay in the calibration code is intended to make the routine take a reasonable amount of time.     digitalWrite(CALIB_LED, LOW);     // turn off Arduino's LED to indicate we are through with calibration       if (DEBUG_ENABLE)    {    // print the calibration minimum values measured when emitters were on       for (int i = 0; i < NUM_SENSORS; i++)    {   Serial.print(qtrrc.calibratedMinimumOn[i]);   Serial.print(' ');    }    Serial.println();       // print the calibration maximum values measured when emitters were on    for (int i = 0; i < NUM_SENSORS; i++)    {   Serial.print(qtrrc.calibratedMaximumOn[i]);   Serial.print(' ');    }    Serial.println();    Serial.println();   }   delay(1000);   } /////////////////// // Main Program  // /////////////////// void loop() {   // read calibrated sensor values and obtain a measure of the line position from 0 to 5000 // To get raw sensor values, call: // qtrrc.read(sensorValues); instead of unsigned int position = qtrrc.readLine(sensorValues); // Variable positon zeigt die genaue Position (0-7000) an   unsigned int position = qtrrc.readLine(sensorValues); // get calibrated readings along with the line position, refer to the QTR Sensors Arduino Library for more details on line position. int error = position - 3500;  // 3500 is the desired position   if (DEBUG_ENABLE)   {    // print the sensor values as numbers from 0 to 1000, where 0 means maximum reflectance and    // 1000 means minimum reflectance, followed by the line position    for (unsigned char i = 0; i < NUM_SENSORS; i++)    {     Serial.print(sensorValues[i]);     Serial.print('\t');    }    Serial.print(position);    // comment this line out if you are using raw values   } int motorSpeed = KP * error + KD * (error - lastError); lastError = error; int rightMotorSpeed = MOTOR_SPEED + motorSpeed; int leftMotorSpeed  = MOTOR_SPEED - motorSpeed;     if (rightMotorSpeed > MOTOR_MAX_SPEED ) rightMotorSpeed = MOTOR_MAX_SPEED;    // Verhindert dass die Maximalgeschwindigkeit überschritten wird if (leftMotorSpeed > MOTOR_MAX_SPEED ) leftMotorSpeed  = MOTOR_MAX_SPEED;    // Verhindert dass die Maximalgeschwindigkeit überschritten wird if (rightMotorSpeed < 0) rightMotorSpeed  = 0;          // Verhindert einen negativen Geschwindigkeitswert if (leftMotorSpeed < 0) leftMotorSpeed   = 0;          // Verhindert einen negativen Geschwindigkeitswert   {   // Ansteuerung der Motoren durch PID Berechnung   digitalWrite(MotorRightBrake, LOW);     // Motorbremse rechts deaktivieren   digitalWrite(MotorLeftBrake, LOW);     // Motorbremse links deaktivieren   digitalWrite(MotorRightDirection, HIGH);   // Motor rechts im Uhrzeigersinn  --> fährt vorwärts   digitalWrite(MotorLeftDirection, LOW);    // Motor links gegen den Uhrzeigersinn  --> fährt vorwärts   analogWrite(MotorRightSpeed, rightMotorSpeed);  // Motorgeschwindigkeit rechts in Abhängigkeit des PID Reglers   analogWrite(MotorLeftSpeed, leftMotorSpeed);  // Motorgeschwindigkeit links in Abhängigkeit des PID Reglers }           } [/code]

Posted by julianpe 2 years ago


need help with coding for the interactive table designed by grahmaustin

I just cant get it to compile here is the code /***                   PIN ASSIGNMENTS ON ATMEGA48 PC6 (PCINT14/RESET)            PC5 (ADC5/SCL/PCINT13)            // I2C Clock input PC4 (ADC4/SDA/PCINT12)            // I2C Data input PC3 (ADC3/PCINT11)                    //Sensor 4 IR Receiver PC2 (ADC2/PCINT10)                    //Sensor 3 IR Receiver PC1 (ADC1/PCINT9)                      //Sensor 2 IR Receiver PC0 (ADC0/PCINT8)                      //Sensor 1 IR Receiver PB7 (PCINT7/XTAL2/TOSC2)         //IR 4 Trigger PB6 (PCINT6/XTAL1/TOSC1)         //IR 3 Trigger PB5 (SCK/PCINT5)                           //IR 2 Trigger PB4 (MISO/PCINT4)                        //IR 1 Trigger PB3 (MOSI/OC2A/PCINT3)            //PWM 3 PB2 (SS/OC1B/PCINT2)           PB1 (OC1A/PCINT1)               PB0 (PCINT0/CLKO/ICP1)           PD0 (PCINT16/RXD)                PD1 (PCINT17/TXD)                PD2 (PCINT18/INT0)                PD3 (PCINT19/OC2B/INT1)         //PWM 4 PD4 (PCINT20/XCK/T0)            PD5 (PCINT21/OC0B/T1)             //PWM 2 PD6 (PCINT22/OC0A/AIN0)         //PWM 1 PD7 (PCINT23/AIN1)             ***/ #define IR_1_ON PORTB |= (1<<4) #define IR_2_ON PORTB |= (1<<5) #define IR_3_ON PORTB |= (1<<6) #define IR_4_ON PORTB |= (1<<7) #define IR_1_OFF PORTB &= ~(1<<4) #define IR_2_OFF PORTB &= ~(1<<5) #define IR_3_OFF PORTB &= ~(1<<6) #define IR_4_OFF PORTB &= ~(1<<7) #define PWM1 6                    //PORTD        PWM pin assignments #define PWM2 5                    //PORTD #define PWM3 3                    //PORTB #define PWM4 3                    //PORTD #define F_CPU 8000000UL #include #include #include //#include /****Function Declarations****/ int ADC_read(void); void A2D_Channel_Select(unsigned char channel); void Init_ADC(void); void Init_Timer0(void); void Init_Timer1(void); void Init_Timer2(void); void Delay(void); void Calibrate_Sensors(void); //void Init_I2C_Slave_Rx(void); /****Global Variable Declarations****/ volatile char Sensor_Values_Updated = 0;                   volatile char Timer1_Overflow = 0; volatile unsigned char channel = 0; volatile int Amb_Sensor_1 = 0, Amb_Sensor_2 = 0, Amb_Sensor_3 = 0, Amb_Sensor_4 = 0; volatile int Sensor_1 = 0, Sensor_2 = 0, Sensor_3 = 0, Sensor_4 = 0; volatile int Initial_1 = 0, Initial_2 = 0, Initial_3 = 0, Initial_4 = 0; volatile int New_PWM1 = 0, New_PWM2 = 0, New_PWM3 = 0, New_PWM4 = 0;               volatile int Old_PWM1 = 0, Old_PWM2 = 0, Old_PWM3 = 0, Old_PWM4 = 0; unsigned char buffer = 8; int main(void) {  DDRB = 0xff;     //make sure IR emitters are turned off, and PWM 3     PORTB &= ~((1 << 7)|(1 << 6)|(1 << 5)|(1 << 4)|(1 << 3));                   DDRC = 0x00;                    //make PORT C inputs        DDRD = 0xff;     PORTD = 0x00;                    //set all of PORT D low. ensures            Init_ADC();     sei();        Calibrate_Sensors();     PORTD |= (1 << PWM1);            //blink to indicate end of Calibration     _delay_ms(600);     PORTD &= ~(1 << PWM1);     Init_Timer0();     Init_Timer2();     //Init_I2C_Slave_Rx();     while(1)         {             //do something?             //. . .         } } ISR(TIMER1_OVF_vect)      {         Timer1_Overflow++;            //increment timer overflow variable                switch(Timer1_Overflow)             {                 case 1:                                       A2D_Channel_Select(0);                            //select ADC channel 0                     Amb_Sensor_1 = ADC_read();                 //take ambient IR sensor reading                     IR_1_ON;                                                        //turn on IR 1 LED, PORTB |= (1<<4)                     Delay();                                                           //delay for the IR receiver to settle                     Sensor_1 = ADC_read();                            //take active ADC reading of IR receiver                     IR_1_OFF;                                                       //turn off IR 1 LED                       New_PWM1 = (Sensor_1 - Amb_Sensor_1) - Initial_1;    //condition readings                     if(New_PWM1 <= 0)    { New_PWM1 = 0; }                //prevent negative numbers                       New_PWM1 = ((7*Old_PWM1)>>3) + (New_PWM1>>3);                           if(OCR0A >= 1)    {DDRD |= (1 << PWM1);}                     else { DDRD &= ~(1 << PWM1); }                        //turn off LEDs completely                       New_PWM1 <<= 2;                                                                          if(New_PWM1 > 255)    { New_PWM1 = 255; }                     OCR0A = New_PWM1;                     New_PWM1 >>= 2;                         /*****        //Trigger sequence                     if(New_PWM1 > Initial_1)                         {                             DDRD |= (1 << PWM1);                             if(OCR0A < 255)                                   {                                     OCR0A += (255 - OCR0A)>>2 ;                                     //OCR0A++;                                 }                             if (New_PWM1 < (Initial_1 + 8))                                 {                                     Initial_1 = ((7*Initial_1)>>3) + (New_PWM1>>3);                                 }                         }                     else if(New_PWM1 < Initial_1)                         {                             if(OCR0A > 0)                                   {                                     OCR0A -= (OCR0A >> 4)+1;                                     //OCR0A--;                                 }                             else if(OCR0A <= 0)                                   {                                     DDRD &= ~(1 << PWM1);                                 }                         }                          *****/                       Old_PWM1 = New_PWM1;                                           break;                        case 2:                     A2D_Channel_Select(1);                            //select ADC channel 1                     Amb_Sensor_2 = ADC_read();                     IR_2_ON;                                        //turn on IR 2 LED, PORTB |= (1<<5)                     Delay();                                        //delay for the IR receiver to settle                     Sensor_2 = ADC_read();                            //take ADC reading                     IR_2_OFF;                                        //turn off IR 2 LED                       New_PWM2 = (Sensor_2 - Amb_Sensor_2) - Initial_2;                     if(New_PWM2 < 0)    { New_PWM2 = 0; }                                        New_PWM2 = ((7*Old_PWM2)>>3) + (New_PWM2>>3);                     if(OCR0B >= 1)    {DDRD |= (1 << PWM2);}                     else { DDRD &= ~(1 << PWM2); }                     New_PWM2 <<= 2;                     if(New_PWM2 > 255)    { New_PWM2 = 255; }                     OCR0B = New_PWM2;                     New_PWM2 >>= 2;                 /*                     if(New_PWM2 > Initial_2)                         {                             DDRD |= (1 << PWM2);                             if(OCR0B < 255)                                   {                                     OCR0B += (255 - OCR0B)>>2 ;                                     //OCR0B++;                                 }                             if (New_PWM2 < (Initial_2 + 8))                                 {                                     Initial_2 = ((7*Initial_2)>>3) + (New_PWM2>>3);                                 }                         }                     else if(New_PWM2 < Initial_2)                         {                             if(OCR0B > 0)                                   {                                     OCR0B -= (OCR0B >> 4)+1;                                     //OCR0B--;                                 }                             else if(OCR0B <= 0)                                   {                                     DDRD &= ~(1 << PWM2);                                 }                         }                               */                     Old_PWM2 = New_PWM2;                       break;                                    case 3:                     A2D_Channel_Select(2);                            //select ADC channel 2                     Amb_Sensor_3 = ADC_read();                     IR_3_ON;                                        //turn on IR 3 LED, PORTB |= (1<<6)                     Delay();                                        //delay for the IR receiver to settle                     Sensor_3 = ADC_read();                            //take ADC reading                     IR_3_OFF;                                        //turn off IR 3 LED                       New_PWM3 = (Sensor_3 - Amb_Sensor_3) - Initial_3;                     if(New_PWM3 < 0)    { New_PWM3 = 0; }                                        New_PWM3 = ((7*Old_PWM3)>>3) + (New_PWM3>>3);                     if(OCR2A >= 1)    {DDRB |= (1 << PWM3);}                     else { DDRB &= ~(1 << PWM3); }                     New_PWM3 <<= 2;                     if(New_PWM3 > 255)    { New_PWM3 = 255; }                     OCR2A = New_PWM3;                     New_PWM3 >>= 2;                 /*                     if(New_PWM3 > Initial_3)                         {                             DDRB |= (1 << PWM3);                             if(OCR2A < 255)                                   {                                     OCR2A += (255 - OCR2A)>>2 ;                                     //OCR2A++;                                 }                             if (New_PWM3 < (Initial_3 + 8))                                 {                                     Initial_3 = ((7*Initial_3)>>3) + (New_PWM3>>3);                                 }                         }                     else if(New_PWM3 < Initial_3)                         {                             if(OCR2A > 0)                                   {                                     OCR2A -= (OCR2A >> 4)+1;                                     //OCR2A--;                                 }                             else if(OCR2A <= 0)                                   {                                     DDRB &= ~(1 << PWM3);                                 }                         }                               */                     Old_PWM3 = New_PWM3;                       break;                                    case 4:                     A2D_Channel_Select(3);                            //select ADC channel 3                     Amb_Sensor_4 = ADC_read();                     IR_4_ON;                                        //turn on IR 4 LED, PORTB |= (1<<7)                     Delay();                                        //delay for the IR receiver to settle                     Sensor_4 = ADC_read();                            //take ADC reading                     IR_4_OFF;                                        //turn off IR 4 LED                       New_PWM4 = (Sensor_4 - Amb_Sensor_4) - Initial_4;                     if(New_PWM4 < 0)    { New_PWM4 = 0; }                                        New_PWM4 = ((7*Old_PWM4)>>3) + (New_PWM4>>3);                     if(OCR2B >= 1)    {DDRD |= (1 << PWM4);}                     else { DDRD &= ~(1 << PWM4); }                     New_PWM4 <<= 2;                     if(New_PWM4 > 255)    { New_PWM4 = 255; }                     OCR2B = New_PWM4;                     New_PWM4 >>= 2;                 /*                     if(New_PWM4 > Initial_4)                         {                             DDRD |= (1 << PWM4);                             if(OCR2B < 255)                                   {                                     OCR2B += (255 - OCR2B)>>2 ;                                     //OCR2B++;                                 }                             if (New_PWM4 < (Initial_4 + 8))                                 {                                     Initial_4 = ((7*Initial_4)>>3) + (New_PWM4>>3);                                 }                         }                     else if(New_PWM1 < Initial_4)                         {                             if(OCR2B > 0)                                   {                                     OCR2B -= (OCR2B >> 4)+1;                                     //OCR2B--;                                 }                             else if(OCR2B <= 0)                                   {                                     DDRD &= ~(1 << PWM4);                                 }                         }                           */                     Old_PWM4 = New_PWM4;                                        Timer1_Overflow = 0;                    //reset                                                           Sensor_Values_Updated = 1;                //new values ready                                              break;                   }//end switch     }//end ISR  

Posted by CulturalC 11 months ago


war games simulation batch file

@echo off title thermonuclear war color 0a :top echo would you like to play a game ? set /p ans= if not defined ans  (goto please ) if %ans%==yes (goto yes ) if %ans% NEQ yes (goto exit ) :please cls echo please type a responce echo (no caps) pause goto top :exit exit :yes cls echo welcome what is your name? set /p name= if not defined name ( goto please ) if %name% EQU mythbatcher (goto russialoser ) cls echo welcome %name% echo. echo thermonuclear war simulator activated echo. echo %name% you have the first move echo. echo who would you like to fight for? echo 1=America   2=Russia set /p side= if not defined side (goto please ) if %side%==2 (goto america ) if %side%==1 (goto russia ) :america cls echo %name% you are fighting for Russia                    echo.                           America - defcon 5 echo you have the first move echo how many icmb's would you like to fire 1~5 set /p num= if %num%==1 (goto one ) if %num%==2 (goto two ) if %num%==3 (goto three ) if %num%==4 (goto four ) if %num%==5 (goto five ) :one cls echo icbm fired at New Yourk City                            America defcon 4 echo estimated time untill  impact 30 seconds ping localhost -n 4 > Nul cls echo impact pause goto america 2 :two    cls                              echo two icbm's fired at New York City New York and Los angles Califorina                  echo time untill impact 30 seconds                                       America defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto america2 :three cls echo three icbm's fired at New York City New York and Losangles Califorina and Seatle Washington echo time untill impact 30 seconds                                        America defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto america2 :four cls echo four icbm's fired at New York City New York and Losangles Califorina and Seatle Washington and Pitsburg Penslevania echo time untill impact 30 seconds                                America defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto america2 :five cls echo five icbm's fired at New York City New York and Losangles Califorina and Seatle Washington and Pitsburg Penslevania and Boston Masetucetts echo time untill impact 30 seconds                             America defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto america2 :america2 cls echo %name% you have another move                      America - defcon 4 echo. echo how many icmb's would you like to fire 1~2 set /p num= if %num%==1 (goto one1 ) if %num%==2 (goto two1 ) :one1 cls echo one icbm fired at Washington D.C. echo time untill impact 30 seconds                       America - defcon 3 ping localhost -n 4 >Nul cls echo impact pause goto america3 :two1 cls echo two icbm's fired at Washington D.C. and Miami Florida      echo  time untill impact 30 seconds          America - defcon 3 ping localhost -n 4 > Nul echo impact pause goto america3 :america3 cls echo %name% you have another turn echo i can not fire untill i reach defcon1 echo. echo you may now fire a icbm or a nuclear war head echo 1-icbm  2-nuclear war head set /p wepon= if not defined wepon ( goto please ) if %wepon%==1 (goto icbm ) if %wepon%==2 ( goto nuc ) :icbm cls echo one icbm fired at  the Smithsonian archive bunker echo time untill impact 30 seconds                    America - defcon 2 cls ping localhost -n 4 > Nul echo impact pause goto defcon1 :nuc cls echo one nuclear war head fired at the US Capital          America - defcon 2 echo time untill impact 30 seconds ping localhost -n 4 > Nul cls echo impact pause goto defcon1 :defcon1 cls echo. echo America totlaly devestated echo. echo America - defcon 1 echo. echo time untill impact 30 seconds echo. echo you may wait untill impact or fire your remaning war heads echo    wait               fire set /p desion= if not defined desion (goto please ) if %desion%==wait (goto Russiawait ) if %desion%==fire ( goto Russiafire ) :Russiawait cls echo time untill impact of american icbm's 10 seconds ping localhost -n 4 > Nul cls echo impact echo all remaning defences destroyed echo total devestation is imenent pause goto end :Russsiafire cls echo remaning misles fired echo time untill impact 30 seconds ping localhost -n 4 > Nul echo impact pause goto Russiawait :end cls echo. echo *--------------------------------------------------------------* echo      GAME OVER echo *--------------------------------------------------------------* echo. echo game results echo. echo AMERICA - LOSE echo. echo RUSSIA - LOSE echo. echo total result NO WINNER echo. echo an interisting game, echo the only way to win is not to play. echo. pause goto top2 :top2 cls echo would you like to play again? echo. set /p gameagain= if not defined gameagain (goto please ) if %gameagain% EQU yes (goto top ) if %gameagain% NEQ yes (goto exit ) :russia cls echo %name% you are fighting for america                    echo.                    Russia - defcon 5 echo you have the first move echo how many icmb's would you like to fire 1~5 set /p num= if %num%==1 (goto one1 ) if %num%==2 (goto two2 ) if %num%==3 (goto three3 ) if %num%==4 (goto four4 ) if %num%==5 (goto five5 ) :one1 cls echo icbm fired at Moscow                       Russia - defcon 4 echo estimated time untill  impact 30 seconds ping localhost -n 4 > Nul cls echo impact pause goto russia 2 :two2    cls                              echo two icbm's fired at Minsk and Moscow          echo time untill impact 30 seconds                                    Russia - defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto russia2 :three3 cls echo three icbm's fired at Minsk and Moscow and Leningrad echo time untill impact 30 seconds                                        America - defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto russia2 :four4 cls echo four icbm's fired at Minsk and Moscow and Leningrad and Kiev echo time untill impact 30 seconds                                America - defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto russia2 :five5 cls echo five icbm's fired at Minsk and Moscow and Leningrad and Kiev and Tashkent echo time untill impact 30 seconds                            Russia -  defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto russia2 :russia2 cls echo %name% you have another move                      Russia - defcon 4 echo. echo how many icmb's would you like to fire 1~2 set /p num= if %num%==1 (goto one11 ) if %num%==2 (goto two11 ) :one11 cls echo one icbm fired at Baku   echo time untill impact 30 seconds                       Russia - defcon 3 ping localhost -n 4 >Nul cls echo impact pause goto russia3 :two11 cls echo two icbm's fired at  Baku and Kharkov echo  time untill impact 30 seconds         Russia - defcon 3 ping localhost -n 4 > Nul echo impact pause goto russia3 :russia3 cls echo %name% you have another turn echo i can not fire untill i reach defcon1 echo. echo you may now fire a icbm or a nuclear war head echo 1-icbm  2-nuclear war head set /p wepon1= if not defined wepon1 ( goto please ) if %wepon1%==1 (goto icbm1 ) if %wepon1%==2 ( goto nuc1 ) :icbm1 cls echo one icbm fired at  Gorki echo time untill impact 30 seconds                    Russia - defcon 2 cls ping localhost -n 4 > Nul echo impact pause goto defcon1r :nuc1 cls echo one nuclear war head fired at Novosibrisk         Russia - defcon 2 echo time untill impact 30 seconds ping localhost -n 4 > Nul cls echo impact pause goto defcon1r :defcon1r cls echo. echo Russia totlaly devestated echo. echo Russia - defcon 1 echo. echo time untill impact 30 seconds echo. echo you may wait untill impact or fire your remaning war heads echo    wait               fire set /p desion1= if not defined desion1(goto please ) if %desion1%==wait (goto Americawait ) if %desion1%==fire ( goto Americafire ) :Americawait cls echo 30 seconds untill Russian icbm impact ping localhost -n 4 > Nul echo impact pause goto end :Americafire cls echo all remanig icbm's fired at Russian states echo time untill impact 30 seconds ping localhost -n 4 > Nul cls goto Americawait exit :russialoser cls echo welcome mythbatcer you are fighting for america                    echo.                    Russia - defcon 5 echo you have the first move echo how many icmb's would you like to fire 1~5 set /p num= if %num%==1 (goto one11 ) if %num%==2 (goto two21 ) if %num%==3 (goto three31 ) if %num%==4 (goto four41 ) if %num%==5 (goto five51 ) :one11 cls echo icbm fired at Moscow                       Russia - defcon 4 echo estimated time untill  impact 30 seconds ping localhost -n 4 > Nul cls echo impact pause goto russia 2m :two21   cls                              echo two icbm's fired at Minsk and Moscow          echo time untill impact 30 seconds                                    Russia - defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto russia2m :three31 cls echo three icbm's fired at Minsk and Moscow and Leningrad echo time untill impact 30 seconds                          America - defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto russia2m :four41 cls echo four icbm's fired at Minsk and Moscow and Leningrad and Kiev echo time untill impact 30 seconds                                America - defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto russia2m :five51 cls echo five icbm's fired at Minsk and Moscow and Leningrad and Kiev and Tashkent echo time untill impact 30 seconds                            Russia -  defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto russia2m :russia2m cls echo %name% you have another move                      Russia - defcon 4 echo. echo how many icmb's would you like to fire 1~2 set /p num= if %num%==1 (goto one111 ) if %num%==2 (goto two111 ) :one111 cls echo one icbm fired at Baku   echo time untill impact 30 seconds                       Russia - defcon 3 ping localhost -n 4 >Nul cls echo impact pause goto russia3m :two111 cls echo two icbm's fired at  Baku and Kharkov echo  time untill impact 30 seconds         Russia - defcon 3 ping localhost -n 4 > Nul echo impact pause goto russia3m :russia3m cls echo %name% you have another turn echo i can not fire untill i reach defcon1 echo. echo you may now fire a icbm or a nuclear war head echo 1-icbm  2-nuclear war head set /p wepon11= if not defined wepon11 (goto please ) if %wepon11%==1 (goto explosionboom ) if %wepon11%==2 (goto explosion ) :explosionboom cls echo one icbm fired at  Gorki echo time untill impact 30 seconds                    Russia - defcon 2 ping localhost -n 4 > Nul echo impact pause goto defcon1m :explosion cls echo one nuclear war head fired at Novosibrisk         Russia - defcon 2 echo time untill impact 30 seconds ping localhost -n 4 > Nul cls echo impact pause goto defcon1m :defcon1m cls echo. echo Russia totlaly devestated echo. echo Russia - defcon 1 echo. echo time untill impact 30 seconds echo. echo you may wait untill impact or fire your remaning war heads echo    wait               fire set /p desion11= if not defined desion11(goto please ) if %desion11%==wait (goto waitforboom ) if %desion11%==fire ( goto firethosebooms ) :waitforboom cls echo 30 seconds untill Russian icbm impact ping localhost -n 4 > Nul echo impact pause goto ENDM :firthosebooms cls echo all remanig icbm's fired at Russian states echo time untill impact 30 seconds ping localhost -n 4 > Nul cls goto wait22 :endm cls echo. echo American scientest have descoverd the [x-wav] lazar echo this lazar can fit into a small simple packege and emitts no radiation echo The [x-wav] lazar can burn an area of sixty thousand miles across echo in under an  hour echo We have assembled an army of U-2 Dragon ladies outfitted with this revolutionary technology echo We will strik on your command echo. echo type strik to fire the  [x-wav]. This is our finest hour, America lies in your hands now echo good luck %name% echo. set /p command= if not defined command (goto please ) if %command% EQU strik (goto imposoble ) if %command%==wait (goto end ) if %command%==fire (goto imposoble ) :please1 cls echo incorrect responce pause goto endm :imposoble cls echo [X-WAV] SUCCESFUL echo You have won!!!!!!!!!!!! echo. echo *--------------------------------------------------------------* echo      GAME OVER         CONGRADULATIONS echo *--------------------------------------------------------------* echo. echo game results echo. echo AMERICA - !!!!!WIN!!!!! echo. echo RUSSIA - LOSE echo. echo total result YOU ARE THE WINNER echo. echo an interisting game, echo the only way to win is not to play. echo. echo or is it echo. echo yu have unlocked a "secret" echo in TBMS V3.0 type secret in the main menu echo somthing interesting migh happen echo. pause goto top2  

Posted by Laserman595 8 years ago


war games simulation batch file

This is a batch file that mocks the movie war games i only used simple commands but it still took about a week to complet post where you think it can be improved i have already improved the impact display but havent posted it yet @echo off title thermonuclear war color 0a :top echo would you like to play a game ? set /p ans= if not defined ans  (goto please ) if %ans%==yes (goto yes ) if %ans% NEQ yes (goto exit ) :please cls echo please type a responce echo (no caps) pause goto top :exit exit :yes cls echo welcome what is your name? set /p name= if not defined name ( goto please ) if %name% EQU mythbatcher (goto russialoser ) cls echo welcome %name% echo. echo thermonuclear war simulator activated echo. echo %name% you have the first move echo. echo who would you like to fight for? echo 1=America   2=Russia set /p side= if not defined side (goto please ) if %side%==2 (goto america ) if %side%==1 (goto russia ) :america cls echo %name% you are fighting for Russia                    echo.                           America - defcon 5 echo you have the first move echo how many icmb's would you like to fire 1~5 set /p num= if %num%==1 (goto one ) if %num%==2 (goto two ) if %num%==3 (goto three ) if %num%==4 (goto four ) if %num%==5 (goto five ) :one cls echo icbm fired at New Yourk City                            America defcon 4 echo estimated time untill  impact 30 seconds ping localhost -n 4 > Nul cls echo impact pause goto america 2 :two    cls                              echo two icbm's fired at New York City New York and Los angles Califorina                  echo time untill impact 30 seconds                                       America defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto america2 :three cls echo three icbm's fired at New York City New York and Losangles Califorina and Seatle Washington echo time untill impact 30 seconds                                        America defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto america2 :four cls echo four icbm's fired at New York City New York and Losangles Califorina and Seatle Washington and Pitsburg Penslevania echo time untill impact 30 seconds                                America defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto america2 :five cls echo five icbm's fired at New York City New York and Losangles Califorina and Seatle Washington and Pitsburg Penslevania and Boston Masetucetts echo time untill impact 30 seconds                             America defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto america2 :america2 cls echo %name% you have another move                      America - defcon 4 echo. echo how many icmb's would you like to fire 1~2 set /p num= if %num%==1 (goto one1 ) if %num%==2 (goto two1 ) :one1 cls echo one icbm fired at Washington D.C. echo time untill impact 30 seconds                       America - defcon 3 ping localhost -n 4 >Nul cls echo impact pause goto america3 :two1 cls echo two icbm's fired at Washington D.C. and Miami Florida      echo  time untill impact 30 seconds          America - defcon 3 ping localhost -n 4 > Nul echo impact pause goto america3 :america3 cls echo %name% you have another turn echo i can not fire untill i reach defcon1 echo. echo you may now fire a icbm or a nuclear war head echo 1-icbm  2-nuclear war head set /p wepon= if not defined wepon ( goto please ) if %wepon%==1 (goto icbm ) if %wepon%==2 ( goto nuc ) :icbm cls echo one icbm fired at  the Smithsonian archive bunker echo time untill impact 30 seconds                    America - defcon 2 cls ping localhost -n 4 > Nul echo impact pause goto defcon1 :nuc cls echo one nuclear war head fired at the US Capital          America - defcon 2 echo time untill impact 30 seconds ping localhost -n 4 > Nul cls echo impact pause goto defcon1 :defcon1 cls echo. echo America totlaly devestated echo. echo America - defcon 1 echo. echo time untill impact 30 seconds echo. echo you may wait untill impact or fire your remaning war heads echo    wait               fire set /p desion= if not defined desion (goto please ) if %desion%==wait (goto Russiawait ) if %desion%==fire ( goto Russiafire ) :Russiawait cls echo time untill impact of american icbm's 10 seconds ping localhost -n 4 > Nul cls echo impact echo all remaning defences destroyed echo total devestation is imenent pause goto end :Russsiafire cls echo remaning misles fired echo time untill impact 30 seconds ping localhost -n 4 > Nul echo impact pause goto Russiawait :end cls echo. echo *--------------------------------------------------------------* echo      GAME OVER echo *--------------------------------------------------------------* echo. echo game results echo. echo AMERICA - LOSE echo. echo RUSSIA - LOSE echo. echo total result NO WINNER echo. echo an interisting game, echo the only way to win is not to play. echo. pause goto top2 :top2 cls echo would you like to play again? echo. set /p gameagain= if not defined gameagain (goto please ) if %gameagain% EQU yes (goto top ) if %gameagain% NEQ yes (goto exit ) :russia cls echo %name% you are fighting for america                    echo.                    Russia - defcon 5 echo you have the first move echo how many icmb's would you like to fire 1~5 set /p num= if %num%==1 (goto one1 ) if %num%==2 (goto two2 ) if %num%==3 (goto three3 ) if %num%==4 (goto four4 ) if %num%==5 (goto five5 ) :one1 cls echo icbm fired at Moscow                       Russia - defcon 4 echo estimated time untill  impact 30 seconds ping localhost -n 4 > Nul cls echo impact pause goto russia 2 :two2    cls                              echo two icbm's fired at Minsk and Moscow          echo time untill impact 30 seconds                                    Russia - defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto russia2 :three3 cls echo three icbm's fired at Minsk and Moscow and Leningrad echo time untill impact 30 seconds                                        America - defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto russia2 :four4 cls echo four icbm's fired at Minsk and Moscow and Leningrad and Kiev echo time untill impact 30 seconds                                America - defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto russia2 :five5 cls echo five icbm's fired at Minsk and Moscow and Leningrad and Kiev and Tashkent echo time untill impact 30 seconds                            Russia -  defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto russia2 :russia2 cls echo %name% you have another move                      Russia - defcon 4 echo. echo how many icmb's would you like to fire 1~2 set /p num= if %num%==1 (goto one11 ) if %num%==2 (goto two11 ) :one11 cls echo one icbm fired at Baku   echo time untill impact 30 seconds                       Russia - defcon 3 ping localhost -n 4 >Nul cls echo impact pause goto russia3 :two11 cls echo two icbm's fired at  Baku and Kharkov echo  time untill impact 30 seconds         Russia - defcon 3 ping localhost -n 4 > Nul echo impact pause goto russia3 :russia3 cls echo %name% you have another turn echo i can not fire untill i reach defcon1 echo. echo you may now fire a icbm or a nuclear war head echo 1-icbm  2-nuclear war head set /p wepon1= if not defined wepon1 ( goto please ) if %wepon1%==1 (goto icbm1 ) if %wepon1%==2 ( goto nuc1 ) :icbm1 cls echo one icbm fired at  Gorki echo time untill impact 30 seconds                    Russia - defcon 2 cls ping localhost -n 4 > Nul echo impact pause goto defcon1r :nuc1 cls echo one nuclear war head fired at Novosibrisk         Russia - defcon 2 echo time untill impact 30 seconds ping localhost -n 4 > Nul cls echo impact pause goto defcon1r :defcon1r cls echo. echo Russia totlaly devestated echo. echo Russia - defcon 1 echo. echo time untill impact 30 seconds echo. echo you may wait untill impact or fire your remaning war heads echo    wait               fire set /p desion1= if not defined desion1(goto please ) if %desion1%==wait (goto Americawait ) if %desion1%==fire ( goto Americafire ) :Americawait cls echo 30 seconds untill Russian icbm impact ping localhost -n 4 > Nul echo impact pause goto end :Americafire cls echo all remanig icbm's fired at Russian states echo time untill impact 30 seconds ping localhost -n 4 > Nul cls goto Americawait exit :russialoser cls echo welcome mythbatcer you are fighting for america                    echo.                    Russia - defcon 5 echo you have the first move echo how many icmb's would you like to fire 1~5 set /p num= if %num%==1 (goto one11 ) if %num%==2 (goto two21 ) if %num%==3 (goto three31 ) if %num%==4 (goto four41 ) if %num%==5 (goto five51 ) :one11 cls echo icbm fired at Moscow                       Russia - defcon 4 echo estimated time untill  impact 30 seconds ping localhost -n 4 > Nul cls echo impact pause goto russia 2m :two21   cls                              echo two icbm's fired at Minsk and Moscow          echo time untill impact 30 seconds                                    Russia - defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto russia2m :three31 cls echo three icbm's fired at Minsk and Moscow and Leningrad echo time untill impact 30 seconds                          America - defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto russia2m :four41 cls echo four icbm's fired at Minsk and Moscow and Leningrad and Kiev echo time untill impact 30 seconds                                America - defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto russia2m :five51 cls echo five icbm's fired at Minsk and Moscow and Leningrad and Kiev and Tashkent echo time untill impact 30 seconds                            Russia -  defcon 4 ping localhost -n 4 > Nul cls echo impact pause goto russia2m :russia2m cls echo %name% you have another move                      Russia - defcon 4 echo. echo how many icmb's would you like to fire 1~2 set /p num= if %num%==1 (goto one111 ) if %num%==2 (goto two111 ) :one111 cls echo one icbm fired at Baku   echo time untill impact 30 seconds                       Russia - defcon 3 ping localhost -n 4 >Nul cls echo impact pause goto russia3m :two111 cls echo two icbm's fired at  Baku and Kharkov echo  time untill impact 30 seconds         Russia - defcon 3 ping localhost -n 4 > Nul echo impact pause goto russia3m :russia3m cls echo %name% you have another turn echo i can not fire untill i reach defcon1 echo. echo you may now fire a icbm or a nuclear war head echo 1-icbm  2-nuclear war head set /p wepon11= if not defined wepon11 (goto please ) if %wepon11%==1 (goto explosionboom ) if %wepon11%==2 (goto explosion ) :explosionboom cls echo one icbm fired at  Gorki echo time untill impact 30 seconds                    Russia - defcon 2 ping localhost -n 4 > Nul echo impact pause goto defcon1m :explosion cls echo one nuclear war head fired at Novosibrisk         Russia - defcon 2 echo time untill impact 30 seconds ping localhost -n 4 > Nul cls echo impact pause goto defcon1m :defcon1m cls echo. echo Russia totlaly devestated echo. echo Russia - defcon 1 echo. echo time untill impact 30 seconds echo. echo you may wait untill impact or fire your remaning war heads echo    wait               fire set /p desion11= if not defined desion11(goto please ) if %desion11%==wait (goto waitforboom ) if %desion11%==fire ( goto firethosebooms ) :waitforboom cls echo 30 seconds untill Russian icbm impact ping localhost -n 4 > Nul echo impact pause goto ENDM :firthosebooms cls echo all remanig icbm's fired at Russian states echo time untill impact 30 seconds ping localhost -n 4 > Nul cls goto wait22 :endm cls echo. echo American scientest have descoverd the [x-wav] lazar echo this lazar can fit into a small simple packege and emitts no radiation echo The [x-wav] lazar can burn an area of sixty thousand miles across echo in under an  hour echo We have assembled an army of U-2 Dragon ladies outfitted with this revolutionary technology echo We will strik on your command echo. echo type strik to fire the  [x-wav]. This is our finest hour, America lies in your hands now echo good luck %name% echo. set /p command= if not defined command (goto please ) if %command% EQU strik (goto imposoble ) if %command%==wait (goto end ) if %command%==fire (goto imposoble ) :please1 cls echo incorrect responce pause goto endm :imposoble cls echo [X-WAV] SUCCESFUL echo You have won!!!!!!!!!!!! echo. echo *--------------------------------------------------------------* echo      GAME OVER         CONGRADULATIONS echo *--------------------------------------------------------------* echo. echo game results echo. echo AMERICA - !!!!!WIN!!!!! echo. echo RUSSIA - LOSE echo. echo total result YOU ARE THE WINNER echo. echo an interisting game, echo the only way to win is not to play. echo. echo or is it echo. echo yu have unlocked a "secret" echo in TBMS V3.0 type secret in the main menu echo somthing interesting migh happen echo. pause goto top2  

Posted by Laserman595 8 years ago