The forums are retiring and are now closed for new topics and comments. The existing content will remain online and accessible through 2020 to provide everyone the opportunity to save any relevant information. In the spring of 2021, these Community forums will be taken offline.

Search for flip digits in Topics


Flip flop?

Hi, I'm a little rusty in digital electronics, does the attached diagram represent a flip flop? I need a logical circuit that change state (output: from 0 to 1 and vise versa) when triggered (pulse). An I.C. number would be more helpful. Thanks!

Topic by Control80    |  last reply


Digital SLR? Answered

1. Why is the use of a mechanical mirror that has to flip out of the way still revered in Photography circles? 2. Why do Digital Cameras still use a mechanical shutter? I have what they call a bridge camera that uses a small LCD viewer (as well as a large colour LCD screen) and as far as I can tell uses an electronic shutter.  It seems to work well and is reliable.

Question by rickharris    |  last reply


Timer to flip light switch?

I need a timer that will mechanically operate a wall switch for a light. I've seen a device years ago for sale in the various "gadget" catalogs that did exactly this. It attached to the trim plate around the light switch using the 2 trim plate screws. A battery powered digital timer operated a mechanical slide to operate the wall switch. I can't find this device anywhere now. I know there are many electronic timers that replace the wall switch and have timer capability, most do not work with compact flourescent lights. I'd really like to find a timer for sale or get some ideas on a simple way to make such a device. Thanks for any help. Scott

Topic by tscottme    |  last reply


Recording digitally with an analog camcorder

I recently came into possession of a mid-eighties Newvicon analog camcorder. It has RCA outputs for the video and audio (mono), and I'd like to record the output from this camcorder as digital. The idea I had initially was to use something like a Flip video camera (in order to keep it portable), but then I realized that the Flip doesn't have an RCA input... in fact, nothing I know of has an RCA input, unless I wanted to plug it into a computer or a DVD recorder, which negates the simplicity of it recording to a video file that can be dragged and dropped onto my desktop. The reason for wanting to salvage this camcorder and use it instead of just using the Flip is because the video quality is incredibly "eighties" - the color is slightly askew, and the sensitivity to light means that moving the camera suddenly causes ghosting, which, to me, is desirable for the look i'm going for. Personally, I find it fun and interesting to use old things like this instead of the new stuff. The only drawback is the simplicity (or lack thereof) in being able to post things immediately in this digital YouTube age. I'd like to keep it portable. I'd like to keep it simple. Any ideas on a camcorder, or even a "digital go between" that would record onto an SD card or USB drive? Does anything like this exist? If not, I'd like something like an SD card go between, as I have a 32 GB SDHC that would work great for this kind of project. This is the same model camera - the video outputs are located on a proprietary PSU, which isn't a problem for me to carry around, or have plugged into an extension cord.

Topic by LinkTGF    |  last reply


Digital Logic Design Project Combinational Lock?

In this project you are required to design a 4 digits combination lock (not using arduino)  The project is such that it can be reconfigurable i.e. there should be an option that we can change the password of the lock at run time. Input to the system is from the hex keypad. Output of the system is ‘open’ and ‘close’ words displayed on a seven segment I used registers,flip flops, mux ,comparator  but couldn't get the desired result

Question by r_sammad    |  last reply


How to make Flip Clock Numbers and build a "like"-counter around it?

Hey All So I've got this client, who's absolutely crazy about the "FLIKE" (A physical like counter.). But he can't have it for another couple of months, and he'd like it to be a little more custom... Long story short, I might end up making a similar product in a few weeks. it will probably consist out of 5 digits and if it's up to me (not sure what the client wants) I'd stuff them behind a long picture frame. Something like this but actually mechanical and not just a picture of it:  http://www.notonthehighstreet.com/thedriftingbear/product/personalised-framed-vintage-flip-clock-print So I started googling every hardware piece I needed and it turns out it's a huge pain to find Flip Clock Numbers / Flip Board Numbers... whatever you want to call them. (What's the right name btw?) You can't just buy these things, let alone in a custom size. So the idea is to build them myself. I found this on wikipedia, which gives a clue about the inside: http://en.wikipedia.org/wiki/File:Analog_clock_with_digital_display.png So I'm figuring out what needs to go in it to make this work. (I'll end up making an instructable about it) The numbers themselves are going to be made out of vinyl stickers. You can easily buy those from ebay in about any size if you look for them. The stickers will be put on to plastic boards. But I'm not totally sure what kind I should get. They should be thin and must be able to stand up straight, yet "easy" to fold. I'll probably get them lasercut, but you should be able to cut them by hand as well. Currently I'm thinking about gluing small metal or carbon rods on the back of those letters. Although I'm not sure if that would be strong enough. Would it be enough to file one side of the rods to get a bigger contact surface? (What do you guys think?) I'm planning of putting the half letters in a drum of ABS or PLA. it should be shaped like this:  |--------| I'm thinking about 3D printing this. But no idea how it'll do... One side of the drum will be connected to a small stepper motor (5.625° with 1/64 reduction). I don't have real experience with stepper motors, but this resolution seems more than sufficient. The other side will be connected to a metal or plastic positioner. Each digit might end up with it's own "unit" so I can swap them separately if they'd break. I've got great experience with lasercut plexi, so I might use that because it's more accurate than wood and I might have some lying around. I was first thinking about 1 stepper motor and a set of gears. I decided not to do that in the end because I don't have good experience with making gears and I can never find the right sizes online. Also, it'll make everything way more complex. So each motor will have it's own controller connected to it. Those controllers would have to talk to an ATMega or something. (I'm planning on using an arduino to prototype, but then just swap the chip and make a stand-alone version without usb etc) The ATMega has to be connected to the internet of course to get the current number of likes, so I'd connect it to a raspberry pi via I²C. I'm not familiar with the GPIO pins on the pi so I figured this would be a save and convenient way to handle this. The ATMega is robust, and I love the Arduino bootloader. A sketch is written in no time, but I have no idea how to start writhing this code for the GPIO pins. So why the Raspberry Pi? First off, this thing might end up being wireless, and since a wifi module for the arduino costs as much as a Pi, I figured this would be easier. The plan is to make the pi run python script that could ask the number of likes from the facebook API. Once returned, it'll send +1 or +5 or +10 over I²C. The arduino shifts the numbers to the correct position and replies with the total number it's displaying (3012 for instance). The PI can then recheck if everything is in sync. As for the set up. Since we have Pi, we can put on a LAMP stack (I know, this is overkill, but it wouldn't hurt either). So for initial set-up, we'd connect the counter to ethernet, browse to it on a different computer via "http://counter.local". And we'd be presented with a web interface. You'll be able to set the URL of the page u want to get the likes from, set and reset the number that is displayed on the counter, and the WIFI settings. The WIFI settings can be saved in the wpa_supplicant.conf file and on reboot it'll automatically connect to this network. From now on the whole system is manageable over wifi via a html interface. For debugging I might enable ssh though. So I guess you've got the whole outline now. I'd like to get your feedback on this! And this for the mechanics, electronics, and software side of things! 

Question by woutervddn    |  last reply


How do you make a digital counter circuit which counts to 10 minutes, it will rings a buzzer and when it continues to 15 minutes, it will rings a buzzer?

I need to make a digital counter circuit which it counts to 15 minutes for my big project in my campus . When the circuit counts to 10 minutes, it will rings a buzzer. Same when it continues to 15 minutes, it will ring a buzzer again. (the circuit is for public speaking, so the speaker knows that he or she already went speak for 10 minutes and 15 minutes). We weren't allowed to use an Arduino, Microcontroller, PLCs, IC NE555, and a 4000 series CMOS IC but we were allowed to use breadboard, flip flop, decoder and 7 segments display. I'm kinda stuck here and I'm thinking it's impossible to make such a thing. Do you have any idea guys?

Question by Najedfahad14    |  last reply


(newsletter) USB Keyboard Hack, Drill Small Holes, Roommate Blocker...

Sign-up for this newsletter: Welcome back! Digital Days Photo Contest - Show us your best photo trick, tip, or homemade gadget to win a new Sony digital camera! Converse Back to School in Style Contest - Make or customize anything school-related and win a gift card so you can make your own custom Converse shoes! CLOSES SUNDAY: SINGER Kids Crafts Contest - Create something crafty with or for a kid and win a sweet new serger or sewing machine from SINGER! CLOSES SUNDAY: Forbes Teach Me Fast Contest - Make a 30-second how-to video and win one of six awesome Flip MinoHD video cameras! Winning videos will be featured on Forbes.com. Winners announced for the Low & Slow BBQ contest! See who won! Want faster updates and inside info? Follow Instructables on Twitter and Facebook! Sew a Where the Wild Things Are Hat How to Tie Various Knots 15 Minutes SMS Door Entry Alarm Drill Small, Precise Holes Win a digital camera! Closes this Sunday! Aluminum Bottle Alcohol Stove Magic Stick Trick Hack a USB Keyboard Door Activated LED Lighting Roommate Blocker Make a Laundry Water Recycler Make Carbonated Beverages Cardboard .357 Magnum Prop Closes this Sunday! Win a pair of custom Converse shoes! Make Your Own Bacon Camp Table for Backpacking Thingamaplush Robot Big Sturdy Loft Sign-up for this newsletter:

Topic by fungus amungus    |  last reply


(newsletter) Soda Can Chain Mail, One-Ingredient Ice Cream, Cardboard Kayak...

Sign-up for this newsletter: Welcome back! NEW CONTEST: Digital Days Photo Contest - Show us your best photo trick, tip, or homemade gadget to win a new Sony digital camera! Converse Back to School in Style Contest - Make or customize anything school-related and win a gift card so you can make your own custom Converse shoes! SINGER Kids Crafts Contest - Create something crafty with or for a kid and win a sweet new serger or sewing machine from SINGER! Forbes Teach Me Fast Contest - Make a 30-second how-to video and win one of six awesome Flip MinoHD video cameras! Winning videos will be featured on Forbes.com. VOTE NOW: Help pick the finalists in the Gorilla Glue Cardboard Contest! Want faster updates and inside info? Follow Instructables on Twitter and Facebook! Genuine Chainmaille from Pop Tabs Beyond Belief and Back - Optical Illusion One-ingredient Ice Cream Build a Cardboard Kayak for Under $40 Win a digital camera! Get crafty! Make Your Own Sports Drink Build a Photographer’s Zoom Spot Ready, Set, Go! Light How to Get a Great Old Sewing Machine Fuse Plastic Bags into a Laptop Case Bike Panniers from Military Surplus Bags Make Your Own Bra Make a Pencil's Lead Potentiometer Share something cool quickly! Win a pair of custom Converse shoes! Motorized Marble Roller Coaster Rework a UPS with Massive Capacity Table Top Aquarium Living Wall Sign-up for this newsletter:

Topic by fungus amungus    |  last reply


Why is my non powered arduino giving power to my lights? Answered

I am running an arduino uno to control three lights for a stop light costume (yes I got the idea from sparkfun. Sadly there will be no X-Bee in this project). These lights draw a pretty high current, so I have some mosfets on a proto-board to make it a little easier on my arduino. The lights are connected to digital pins 5,4,3. I have a power source at Vin and the thing is grounded at the ground pin right next to Vin. I have a switch grounding the arduino when flipped. When the switch is flipped the other way it gives me manual control, where there is a three way switch giving me the ability turn on and off whichever three series of leds I choose (all the leds are switched on and off via cathode being connected, not anode). The problem comes in here. When the proto board is attached I have control of the leds manually and everything is fine and dandy. Then When I attach the arduino, all three of the series of leds light up, until I switch back to automated mode(I haven't programmed the arduino yet so it just runs the las code, i.e. the pin 13 led blinks). I checked for short circuits and there are none. I am just wondering if there is a way to keep the arduino from connecting these things or should I just use the arduino or just use manual control.

Question by GenAap    |  last reply


(newsletter) Automatic Cat Feeder, Silk Spectre Costume, Funnel Cake...

Sign-up for this newsletter: Welcome back! Mega Contest: It's our most awesome Halloween Contest ever! Any Instructable published since the last Halloween contest is eligible! Win great prizes from Singer, Dremel, Ponoko, Monkeylectric, Photojojo, and an Instructables Pro Membership! Arduino Contest - Make anything involving Arduino and win an Arduino Mega or a sweet prize from Evil Mad Science! Vote Now: Digital Days Photo Contest - Vote for your favorites! Want a more convenient version of Instructables with fewer ads? Get a Pro Membership! Cat Powered Auto Feeder Tasty Homemade Funnel Cake Loop Back Lacing Easy iPhone Alarm Clock Stand Dozens of great prizes in six categories!  Win sweet prizes from Evil Mad Science! Build a Wireless Camera Controller Silk Spectre Costume Analog Electricity Usage Meter Bunch of Grapes Dog Costume   Single HD Gyro Image Stabilizer Create a Realistic Burn with Makeup Pet-Resistant Chick Brooder Cheap and Easy Steampunk Keyboard Little costumes for the big day!  Turn your home into a House of Terror! Electronic Door Opener How to do a Flip Turn Create Real Working iPod Costumes Portable, Paperless, Digital Copier   Now go make something awesome, and I'll see you next week! - Eric Instructables.com - 82 2nd St. - San Francisco, CA Sign-up for this newsletter:

Topic by fungus amungus    |  last reply


Mechanical and optics help needed for camera tinker project Answered

Hi, Some time ago I acquired a beautiful old bellows plate camera, quite closely resembling the top one on this page. Mostly I try to use old cameras with the film they're designed for, but plate photography is going a bit to far for my tastes. Therefore I set out to convert the camera to a digital one. Something like the SVP FS1700 seems perfect for turning into an improvised digital back, but I think I'll need something to look through and focus as well. I've made a quick sketch of what I think would be a good construction, it can be seen at http://www.incarnations.nl/temp/camera.jpg. (1) and (2) are mirrors, projecting the image on the ground glass plate in the camera to the viewfinder on top. When the camera has been aimed and focussed, mirror (1) can be flipped down, allowing the scanner (3) to take the picture. I'm a kinda decent tinkerer, but I've got no experience with lenses, mirrors and the like. A couple of questions I'd like to have answered: 1) Does this have any chance of actually working? 2) What would be the best way to determine the proper placing and angle of the mirrors? 3) The distance between the scanner and the glass plate might cause some focus problems. Could this be worked around with lenses or an extra ground glass plate, or will this cause more trouble than it's worth? 4) As an added bonus I'd like to add split-images focus to the viewfinder, but I have no clue how this works. It can't be as easy as just buying the prism/glass and inserting it into the viewfinder, right? Any help or advice anyone can give me would be greatly appreciated!

Question by Fransvb    |  last reply


micro camera for Rc planes

If been wanting to film some of my Rc flights iv been thinking of two ways to do this: A.) buy a mini camera (not wireless could cause interference with other planes or mine although it should only affect 2.4GHZ or spreed spectrum channels which are designed to handle this kind of interference but i dont want to cause any accidents) or B.) Buy a cheep digital camera and mount it to plane Things to consider:Any thing will add weight to the plane which will affect balance (to solve this add weight till balance)I want to avoid wireless. How to power; battery's weight a lot and take up lots of spaceDragSize of cameraIf i do use micro camera where will it record too?Dose any one have any suggestions or ideas on the best way to do this on the cheep?Original form (it was origanaly posted in that group but it got separated) *update* i found a Camera called the flip video camera it has every thing iv been looking for its cheep about 150$, has a tripod mount, records 60 min of video, comes with editing software, runs on 2 AA batteries, and has a small (1.5inch) Lcd screen

Topic by i make shooting things    |  last reply


micro camera for Rc planes

If been wanting to film some of my Rc flights iv been thinking of two ways to do this: A.) buy a mini camera (not wireless could cause interference with other planes or mine although it should only affect 2.4GHZ or spreed spectrum channels which are designed to handle this kind of interference but i dont want to cause any accidents) or B.) Buy a cheep digital camera and mount it to plane Things to consider:Any thing will add weight to the plane which will affect balance (to solve this add weight till balance)I want to avoid wireless. How to power; battery's weight a lot and take up lots of spaceDragSize of cameraIf i do use micro camera where will it record too?Dose any one have any suggestions or ideas on the best way to do this on the cheep?*update* i found a Camera called the flip video camera it has every thing iv been looking for its cheep about 150$, has a tripod mount, records 60 min of video, comes with editing software, runs on 2 AA batteries, and has a small (1.5inch) Lcd screen

Topic by i make shooting things    |  last reply


What can i Do with all this Stuff?

Ok i have alot of old electronics and i want to know what i could do with them. I have a mp3 player like 6 old cell phone (2 from the 90's, 2 Nextel Flip phones, 1 Samsung (x24 or something like that), 1 Motorola) A laptop with a broken screen and somethings up with the hard drive A old toy was ment to scan barcodes A Ipod Nano with a broken screen and messed up battery A InfraRed Camera (Still works) A Disposable camera (brand new) A re-usable camera (still works) A digital camera (cheap camera no LCD screen) A Taser A Laser A UV light A CD/Mp3 Player Walky-Talkies Old Computers (just missing Hard Drives) And some other stuff but I can't remember what. But that's most of it. Oh and a security camera hub, I guess. It's were you connect the cameras to be seen on the monitor. Receiver, I think that's what it's called. So yeah any Ideas............... I'm really bored and I always wanted to make something fun with this stuff. Just kinda keep it simple because I'm kinda new at this stuff. Or give me step by step details. Ive looked around this site but i haven't found anything.

Topic by Bl0wMe  


This arduino code does not work as expected, any help? there seems to be an issue with the digitalWrite function. Answered

Recently, I wanted to make a laboratory grade linear semi-precision power supply using an Arduino, LCD, some comparators, and MOSFETs. Idealistically, I want measurements to be 3 significant figures of precision (0.1% accuracy @ 30V), voltages as high as 30V, and max current of 10A. The power supply is most likely going to be just a single regulated output, maybe if I feel lucky I will make 2 regulated outputs once I get the darn Arduino code to work. The Arduino's job is to simply set and read the output voltage, and is not part of the control loop. That is what the comparators are for. (I learned the hard way that using the Arduino within the control loop just results in parasitic oscillations because the Arduino is a clocked device and can only self correct at timed intervals.) Anyway, below is the code. I made explanations of all portions of it as clear as possible, and I also give the wiring used for the LCD, 4 buttons, and analog inputs used to set and read the voltage and current. However, the issue arises when I upload the code, the setVI button does not work unless I press both it and the RS button at same time. I made the many of the integers display in the serial output to diagnosing easier hopefully. I can see the setVI integer and my dudd integer only goes HIGH when  either it and the RS buttons are pressed simultaneously, or when the RS butten is held down for a long enough time. However, as far as I am aware, nowhere in the code do I manipulate that code so setVI goes HIGH dependant on other buttons, so I am bewildered by this parasitic phenomenon. Is my Arduino MEGA broken? I had a similar problem in the past, where I had multiple analogRead statements It strangely seemed to factor in the outputs of other input pins. Anyway, here is the code. Maybe someone could upload it and tell me if it functions properly on their arduino? That would help me determine if it is indeed a software issue. (p.s. I use an Arduino ripoff called the Funduino, but it is not broken in any way, I don't think?) Any and all help would be greatly appreciated, thank you in advance, -Max-. p.s. To make the code below legible, please copy/paste it in an IDE or in notepad and convert it into a monospaced font, it will make it very easy to follow. //---------------------------------------------------------------------------------------------------------------// /* Arduino Software for lab power supply. Wireing guide:        **Wiring for 16x2 LCD:**       * LCD RS pin to digital pin 12       * LCD Enable pin to digital pin 11       * LCD D4 pin to digital pin 5       * LCD D5 pin to digital pin 4       * LCD D6 pin to digital pin 3       * LCD D7 pin to digital pin 2       * LCD R/W pin to ground       * 10K resistor:       * ends to +5V and ground       * wiper to LCD VO pin (pin 3)    **Wiring for buttons:**       * RS       button to pin 6  (as a digital input) -- Switches from reading read current/voltage values to setting those values, and Vice Versa.       * VIselect button to pin 7 (as a digital input) -- Switches to the 'set' mode and flips from setting the voltage to setting the current.       * UP       button to pin 8  (as a digital input) -- Increments the voltage or current up when in the 'set' mode.       * DOWN     button to pin 9  (as a digital input) -- Increments the voltage or current up when in the 'set' mode.    **Analog inputs/outputs:**       *A0   -- Measures a potential of a resistor divider that can output a voltage of 0-5V based on the 0-30V output this PSW capable of.       *A1   -- Measures the current flow through a resistor to measure current. (Some reason there seems to be a pulldown resistor on this pin, so the voltage does not float.)       *Vout -- This will be later implemented if I get a DAC, for the increased resolution. (1024 is just not enough in my opinion. At least 12 bits)       *Aout -- This will be later implemented if I get a DAC, for the increased resolution. (1024 is just not enough in my opinion. At least 12 bits) */ int UP    = 0;      // These are the 2 buttons used to incrementally int DOWN  = 0;      // step up or down the voltage on the output int RS = 0;         // These 2 buttons tell the LCD to either read out the voltage on the analog pins. (I plan to change this so it reads from a 14 bit ADC and writes int setVI = 0;      // the voltage output through a 14 (or 16 bit) bit ADC. I need 3 significant digits, or at least 0.1% accuracy. int dudd = 0;       // this dudd (dummy variable) is just here to prove that digitaslreading pin 7 works very weird! Any help on this? int preRS = 1;      // Anything with a "Pre" before it is simply what said integer/variable on the last loop. I use these to prevent a parasitic int presetVI = 1;   // oscillation of states that they control, so when a button is pressed, it will not jump between 2 states every cycle. int preUP    = 0; int preDOWN  = 0; float Aset = 0.00;  // I need these to be "floated" so I can set the exact value of these to 3 significant digits. float Vset = 0.00;  // Aset and Vset define what the output voltage *should* be, and are defined with the UP/DOWN buttons. int VIselection = 1;// this variable will invert when Aset button is pressed. Similar to the IVselect, this number will also invert int READorSET = 1;  // Bset button is pressed. This allows the mode to be changed from SET mode or the READ output mode, thus allowing                     // one to compare the output voltage and current to the set value, as well as set the output voltage and current. #include LiquidCrystal lcd(12, 11, 5, 4, 3, 2);// initialize the library with the numbers of the interface pins void setup() { //-------------------------// I tried making diagnosting this thing easier by making all the important data availible in the serial monitor.   lcd.begin(16, 2);   Serial.begin(9600);   Serial.print("INPUTS         RS:           READorSET:       setVI & dudd:        VIselection:");   Serial.println(""); } void loop() {   float V = (30.00*analogRead(A0))/1024.00;   //These are what I use to read the voltage output of my power supply. I will have a voltage divider on the output,   float A = (15.000*analogRead(A1))/1024.000; //to limit the voltage range from 0-30V to 0-5V. Same concept goes for the current measurement.   int dudd  = digitalRead(7);//   RS    = digitalRead(6);//RS stands for "Read/set"   setVI = digitalRead(7);//VI is stands for "Current/Voltage set"   UP    = digitalRead(8);//UP is simply a button used to set voltage & current   DOWN  = digitalRead(9);//DOWN is simply a button used to set voltage & current     if(presetVI == LOW && setVI == HIGH){VIselection = -VIselection;}   if(preRS    == LOW && RS    == HIGH){READorSET   =   -READorSET;}     Serial.print("\t        ");  // prints an inital space.     Serial.print(RS);            // prints the RS reading. It should be '1' when pin 7 is HIGH.     Serial.print("\t        ");     Serial.print(READorSET);     // prints the READorSET reading. This should only change when the RS button is pressed.     Serial.print("\t        ");     Serial.print(setVI);         // prints the setVI reading. It should be '1' when pin 7 is HIGH.     Serial.print("\t");     Serial.print(dudd);         // prints the setVI reading. It should be '1' when pin 7 is HIGH.     Serial.print("\t        ");     Serial.println(VIselection); // prints the VIselection reading. This should only change when the setVI button is pressed.         //if(presetVI == LOW && setVI == HIGH && READorSET == 1) {READorSET = -READorSET; VIselect = -VIselect;}      // This line of code just makes so that when I need to go from the voltage read screen to      // the set mode, I can just press the VIselect button. It just makes things more intuitive, but could be      // causeing the error, so I nulled it. I also nulled it out another portion that will keep the voltage or      // current setting the same when using the VI buttton to select the set mode. (otherwise it has to be      // double pressed to return to, say, the current setting, if that is where you left off.)   if(UP == HIGH && DOWN == LOW && VIselection == -1){if(Aset <= 10.00) {Aset += 0.05;}}   if(DOWN == HIGH && UP == LOW && VIselection == -1){if(Aset >= 0.10) {Aset -= 0.05;}}     if(UP == HIGH && DOWN == LOW && VIselection == 1) {if(Vset <= 30.00) {Vset += 0.05;}}   if(DOWN == HIGH && UP == LOW && VIselection == 1) {if(Vset >= 0.05) {Vset -= 0.05;}}     if (RS == HIGH){digitalWrite(13, 1);}   if (RS == LOW){digitalWrite(13, 0);} //============================================================================================================//   if (READorSET == 1){      //this is the defualt screen, and shows the output voltage and current.     lcd.clear();              lcd.setCursor(0, 0);     lcd.print("VOLTAGE:");     lcd.setCursor(0, 1);     lcd.print("CURRENT:");     lcd.setCursor(10, 0);     lcd.print(V);     lcd.setCursor(15, 0);     lcd.print("V");     lcd.setCursor(10, 1);     lcd.print(A);     lcd.setCursor(15, 1);     lcd.print("A");   }   if (READorSET == -1){   // This is the portion of the code allowing me to set the current and voltage     lcd.clear();          // using the up/down buttons.       if (VIselection == -1){         lcd.setCursor(0, 0);         lcd.print("  SET CURRENT:");         lcd.setCursor(5, 1);         lcd.print(Aset);         lcd.print("A ");       }       if(VIselection == 1){         lcd.setCursor(0, 0);         lcd.print("  SET VOLTAGE:");         lcd.setCursor(5, 1);         lcd.print(Vset);         lcd.print("V ");       }   } //============================================================================================================//   presetVI = setVI; // At the end of each loop, the current variable settings that were used are set equal   preRS = RS;       // to the 'pre' versions of the code. This allows me to basically measure the when                     // the button is initially pressed, and/or released. Using this method with the delay()                     // function, however, is a bit buggy, but I did have it working well enough before. If you                     // tap the button too quickly. You almost have to hold it for a split second. If you                     // know a better, simpler way of doing this, please tell me, thank you.                       delay(80);        // The delay helps stabilize the reading on the LCD, but if it is too large, than the                     // refresh rate suffers, and the buttons respond slower. However, setting too low will                     // cause the reading on the display to change so rapidly, it is illegible. }

Question by -max-    |  last reply


TV antennas and what is possible indoors

Back in my young years a TV antenna was on the roof, quite big and only required to get 3 or 4 channels at best.The basic design of these Yagi antennas has not really changed since then.Same for the antennas required to get UHF and VHF channels at the same time.They either comes as two seperate antennas with a mixer or as a UHF antenna with some added loops for UHF.To talk some basics:For UHF you can get away with quite small dimensions for your antenna bits.After all a quarter wavelengths here is only around 15cm long.With VHF though we get already 30 to 40cm here depending on the channels.So called bradband antennas claim to be able to get a wide range of frequencies.That however is only true for their dedicated frequency band.If you take a normal whip style antenna then this becomes obvious - just compare the lenghts required and you realise "going the middle way" will mean neither UHF nor VHF would get any usable reception.For a long time now there is the option of so called "fractal antennas" to get better TV reception....Fractal antenna? What the heck is that?The theories behind them are about as old as fractal antenna designs that were not even considered to be fractals.Let me explain with the example of a standard FM radio antenna.For them we use frequencies from about 88 to 108MHz.And of course, for our cars they are always on the roof or mounted somewhere around the wheel arches.Some cars however does not seem to have any antenna depsite having a working radio.In this special case rest ensured they do have one, usually behind the plastic bumper bar ;)I like to go off road every now and then and lost count how many times I had to replace my antenna after getting to close to some bushes and trees.As a solution I used some thin wire to create a L-style anteanna on the inside of my windscreen.And funny enough it picks up more stations than a "proper" antenna outside.Really old design and if you think about it then an antenna with a kink that looks like L is ""self similar" - the definition of a fractal ;)More complex shapes like the Sierpinski models do exactly the same just in one more dimension.Cell phones use them as well as you WiFi router that has no external antenna anymore.Their designs and looks are so different that it is next to impossible to list the currently used shapes here.What it comes down to, when you just take a very basic flat or wire shape is that the straight single segment of the active antenna is split into one or many shorter segments that change the angle.They all have similar relations to the wavelenght still.Means really long segments might be half of a wavelength while the shortest bits are just 1/64 of a wavelength.Think of it (far too simple of course) like amny matched antennas combined into a single one.With that often comes a destinct radiation pattern, usually with a quite narrow beam angle that provides a quite high gain.Are fractal antennas any better than for example a proper Yagi antenna?You can ask 100 people and you get 100 different opinions for this one.This is mostly due to some simple facts like:Not caring about actual comparisons.Not being accurate enough when building the fractal antenna.Using just very basic equippment to compare results.For example when you have a 30 year old and quite small TV antenna on your roof and struggle with digital TV reception than you might want to just replace it all.In some case even the old rabbit ears on your TV set will work better.But take modern Yagi antenna with 12 or more segments and even station that are 100 miles away have a good chance.Comes down to possible gain, frequency match and of course how well the antenna is aimed at the transmitter.Then why is it that some fractal antennas still seem to perform so much better?The big antenna scam....If you paid attention during the intial DVB-T rollout in your country then noticed two things.a) You were told you need a TV or set top box capable of receiving DVB-T signals.b) You need a suitable antenna.Well, A is obvious but for B a lot of people got scammed badly.You see, in almost all cases the frequencies allocated for TV signal did not change at all.And an antenna really does not care if the incoming signal is analog or digital - it only cares about the frequency.But more and more local stations often meant that the trnsmit power is limited.After all it makes no sense to have a 500kW transmitter if the area to cover is only about 20 square km big.So people were told they need new antennas once the noticed digital TV is more like playing Tetris, blocks everywhere....You analog TV had no problem with a slightly weak signal, you did not really notice it unless the weather was really bad as well.All the benefits of digital TV however only work with a proper signal strength.If your areas still has both analog and digital TV channels then have a look on how your local transmitter provides the signals ;)Part of the big scam was hiding a very simple fact:All analog TV is transmitted in a horizontal orientation while almost all digital TV is transmitted in a VERTICAL orientation.Ok, we already gain and ignored it but why would the orientation be important?Your radio antenna is vertical because the FM signal is transmitted the same way - the "waves" if you like go up and down like a sine wave.You still get reception if you turn the antenna 90° to make it a horizontal one but you will realise that weak station are no longer available.The same happened with digital TV.And if there is only digital TV left in your area then simple turning your antenna 90 on the mast to have the single elements vertical instead of horizontal gives you top reception again ;)If you struggle to get all station then just try it out before buying a new antenna ;)Modern fractal TV antennas come paper thin and often with rediculous claims in terms of gain and range.On Fleabuy you can even find models claiming to get stations from over 2000 miles away LOLSome even come with the fake claim of being omnidirectional, meaning it does not matter where you place them or how you orient them.A fractal antenna can't change basic phsyics though...High gain mean highly directional or at least with a very flat radiation pattern instead of being more like a sphere.A high bandwidth means you compromise on the gain and/or the phsical dimensions.For example a thin whip antenna is quite limited in the optimum bandwidth while a piece of tubing provides amuch higher bandwidth but at the expense of gain (and some other problems).A fractal antenna can compromise between the two worlds much better than anything straight.And you would even need to make the traces on the plastic extremely wide because you can simply add different lengths for different frequencies.Means a wideband fractal antenna for FM, VHF and UHF basically is three different antennas combined into a single one.It also means that there is usually always more than just one single element of the antenna that is receiving a signal.If you experimented with WiFi antennas for your router or modem than you certainly found the famous Pringles can antenna - highly directional and with an insane amount of gain.Works exactly like a simple directional microphone.And you could, at least in theory do the same with a TV antenna - if there wouldn't be the problem of the wavelenght.A pringles can works for WiFi because the wavelenght only requires an antenna of about 3cm in lenght.You might not want a row of steel drums with a diameter of around 80cm on your roof just to watch the news though...Ok, if I need a new antenna anyway then should I get a fractal antenna or not?I try to make it simple:Roof option not possible or too costly AND your transmitter is not too far away then try one of the cheap paper thin antennas you find online.If you already have an antenna on the roof that is suitable for the frequencies you need then check it to know if it is still any good.With age and weather comes corrosion and some antennas are connected badly in this regard.Sometimes you are lucky and all it takes is to cut off a few cm of cable to get back to clean copper and to give the terminals on the antenna a good fine sanding or a wire brush treatment.In other cases you might find an amplifier under the roof that has faulty power supply ;)And well, certain animals love to chew through your cable...If all is goo from antenna to TV then as said try to flip the antenna 90° to get it vertical.No, I did not mean to point it up to the sky..... ;)I mean rotate it around the x-axis if X is pointing in the direction of the transmitter...

Topic by Downunder35m  


Component to switch multiple data lines?

I'm looking for a component that I don't know the name of because I have very little electronics experience and asking google these types of things seems to get me everywhere except where I need to be. What I think I need is something that will allow me to switch between four different data lines simultaneously but default to four other lines. For example: Input 1 has four lines. Input 2 has four lines. There is one output with four lines.Real World Problem:I bought a digital picture frame for super cheap and didn't get a chance to research it. It is powered by a USB wall transformer. When the picture frame is receiving power from the wall, it displays the images. When it's plugged into the computer, it goes into update mode and mounts a drive that you can copy images to.What I Want Now:To be able to flip a switch and have it change from USB wall transformer to USB PC. So, from the above: input 1 = USB wall power, input 2 = PC USB, output = picture frame. The switch box would have a 2x USB Mini-A inputs and one USB Type A output.What I Want Later:I imagine it's trivial(?!) to change the physical switch out for a 555/556 timer and two potentiometers so that I can have set a Frequency and Duration of changing from the default wall power to the PC's USB power.What I Get:A picture frame that every x minutes switches to the PC for y minutes so that I can write an application to look for a newly mounted volume called KODAKFRAME (just an example) and create images for it of things like the latest news and weather or maybe even just change out the pictures for variety.My Real Motives:I'm an IT guy and would love to use this as an auxiliary display for info that isn't critically time sensitive such a free disk space, recently received FTP files, etc.Thanks in advance,3Toe

Topic by 3ToedBoxTurtle    |  last reply


Residential 3-way switch problem with leaking voltage?

I noticed a slight glow in the light when it was switched off. LED bulbs in a ceiling fan/light fixture. House built in 1905, wired whenever? using all-fabric insulation type wiring but not knob and tube .  Removed the load from sw 2 and tested travel wire voltages and got 95 v on one and 25 v on the other. Flip sw 1 and the voltages trade wires along with the switch position change.  The switches tested OK but replaced both anyway and got duplicate readings when repeating tests. Isolated the travel wires and got no continuity  (infinite resistance) using all scales of an analog meter as well as a Fluke digital multi-meter.. We checked for voltage feedback from another circuit and even used an extension cord to a different circuit in order to use a different ground wire. With the load connected, the travel wire being used shows 120 v but we still get 25 v on the other wire. I discovered this because when I bought the house only sw 2 worked the light, and one travel wire was disconnected at sw 1 and taped  off.. I have not opened the ceiling box at the fixture because the problem exists when the wire to it is disconnected.The previous owner said he didn't remember what sw 1 went to because it hadn't worked for many years.   So we eliminated worn insulation or nail into the cable because either one  would cause a resistance reading below infinity. All we can think of is a legacy doorbell. Neither of us remembers working one, but I know some used 120 volts and a relay.  People have told me that relay contacts can cause this problem when they get worn. Does anyone have any ideas? I'm retired on a fixed income and tearing walls open is an absolute last resort.  Thank you in advance for any advice I can get!

Question by gerryk8    |  last reply


Is my book good ?

Well i hate to bother anyone but can you please take some time to read this book i worked hard on ? i spent  countless hours of my free time over the weekend developing the plot and creatures so can you please take some time out to read the whole thing tell me what it needs or what would be good i already am 16 pages into the sequel so tell me if this is good so i can post the sequel ! enjoy Times come by Alby Chapter 1- beginning It was the night I would never forget,the night.......i....the......the last night I would enjoy life. It was spring of 2017 the night air was heavy in my lungs and you could faintly smell the BBQ and charcoal smoke from cookouts that died down hours ago I could here people talking and having a good time but I think my drink I grabbed the wrong beer it was Sarah's it was spiked I never would have noticed who did it at least it wasn't her to drink it. I simply enjoyed the sky line of Chicago filled with sky scrapers and mirror like office buildings it all seemed like a Bokeh picture to me the drug is taking affect on my body I feel dizzy . I hopped on the train, it was empty as for the weather gave a good reason to walk but I needed to get home safely. In about 30 minutes I was home. I clumsily walked up the stairs and almost fell it took about ten minutes before I opened the door, I then plopped down on my bed and ran to the bathroom and regurgitated everything I ate that night. i starred at the ceiling. I saw every detail to the nearest centimeter and then blurry the specks the marks swirled in my vision and I felt weightless for a while. I starred at the clock and noticed it was about 4:00 am and cursed myself for going to that bar with Sarah I threw up all over my bed. I tried to grab the phone to call the paramedics but I fell and hit my head on my night stand. I passed out from the concussion i fell into a deep sleep a very deep sleep. Chapter 2 Change I wiped the crust out of my eyes and felt my head a sharp pain rippled thru my scalp it was a Gash about two inches in length. i walked into the bathroom I pulled the faucet but all that came out was a wisp of air. I snatched a baby wipe and cleaned off my face I cleaned my wound with alcohol the sting ive gotten used to I used to get hurt pretty bad in the army, I got shrapnel in my knee and they sent me home the first year. I noticed a dead silence on the street I thought they probably closed it off for some type of repair. I put on my white tee shirt and noticed its softness and how it fit snug on my semi-muscular figure I was in good shape for a twenty-four year old, my mom would always tell me most of the people in America are fat but I guess she loves to tell stereotypes for what they are. I put on my jeans and not forgetting the belt this time either. I snatched my keys off the kitchen counter and headed for the door. I walked outside and paused too look at the empty streets filled with litter and carnage . My mouth wide open in amazement I asked myself what happened and pondered the different reasons riot,panic,fire what could cause such a mess, I walked towards a police squad car and smelled something rancid I slowly proceeded, I instantly veered back in panic I could not believe what I saw a dead police officer lying face down with half a chunk blown clean off his head. There were pieces of it every where splattered on the windshield and door of the police car and some on the concrete. I instinctively inched towards him and thought to myself that something bad is happening and I need protection. I unhooked his holster off his waist and placed it on mine I pulled off his Kevlar vest and put it on weirdly enough it barely was messy or smelled bad. I checked the pockets of the vest and took out a pair of keys I knew it belonged to his squad car. I first popped open the trunk and saw it glistening in the sun a Ar-15 assault rifle. I picked it up and the memories of my army training it just instantly popped into my mind. I guess it applied the same here, I slung it around my back and walked into the silence. I took out the pistol put in the clip pulled the slide back and switched the safety off and cautiously held it. I believe the gun made me more nervous than whats in the shadows, I walked down the narrow street and saw it the skyline of the city filled with smoke and fire. I stood in anger and confusion my home town ravaged broken and charred blood stained the streets and walls, but why.....why....how could this... I mean what could....d..do such a thing. I walked away in the opposite direction and then cut into an alley way to piss and paused as I heard a roar I looked up and saw a quick glance of the belly of a apache attack craft it quickly zoom by and then another. I looked away and ran out of the alley and then down the street to see what direction they were heading. They sped towards the lake area and then I saw a tiny black object fall horizontally from the choppers belly and it slowly fell, then a explosion. I could feel the vibrations. the explosion ripped the lake area into nothing....nothing..but....but...smoke. My heart skipped a few beats thinking what if the next one falls in this area I quickly broke my daydream and bolted as fast as I could as far as I could until I saw a woman crawling on the concrete she was Moaning and holding her stomach. I came up behind her and asked for help. She turned on her back “ Sarah? Ohh my god sarah are you okay ?” and she held a gun in her hand a Glock 22 model the slide locked all the way back and no clip in the gun. I kicked it out of her and and sprung on her she begged for mercy “albert you have to stay away from me im turning” she saw that I was armed and quickly told me the gun was unloaded and that she was sorry she told me she would do anything just get away from her . I told her “Im not here to hurt anyone I just want to help” I starred at her beautiful figure her perfect face and thin hourglass body but ragged cloths and red eyes from crying. How and what did she go thru that could turn her into such a wreck. She got up and put her arm around my shoulder kissed me on the cheek and passed out. I dragged her to an fenced off alley where there was a mattress I put her down and sat next to her .she hugged me and began to cry she than jumped on top of me “Sarah what are you doing no we cant do this now no!” I told her I will help her but I dont think she understood a word I said. She looked at me in my eyes I could feel her touch my soul, her blue eyes glared in the sun. “i dont want to die alone please” I stood up nervously, I was concerned for her health when suddenly I heard a bang then felt a sharp pain in my leg. I collapsed in agony and saw the cause of my pain a bean bag round I looked up and saw a gas mask wearing figure he shot me with another bean bag round in the knee, from his shot gun he then walked over my numb body and. picked up both bean bag's and threw it aside two people in hazmat gear grabbed Sarah and took off her clothing I screamed “what are you doing to her!!!” they did not acknowledge me they looked at her body like they where searching for something. Her passed out figure limp as a rag doll they removed her pants then her underwear I screamed “No!! you son of a bitch don't do it ill kill you” they studied a bite mark on her upper thigh they made some type of hand signal and left. the soldiers then they came and started pouring gasoline on the mattress and her body. the one with the kriss super V took his cigarette out of his mouth and then flicked it at her it rolled of of her shapely belly and hit the mattress her body bursted into flames and she spasmed and kicked wildly. Then the man pointed it me and said in a British accent “ knock that fuckin Yankee an put em in da ACP double time, thoes hungry bastards are comin” Chapter 3 world gone mad I awoke on a bed in clean clothes and a hair cut. I stood up and walked into the hallway and noticed that this was a hospital. Suddenly a hand grabbed me. “aey where do you think your going ya damn runner rapist” I starred at him & his arrogant look and heavily customized ACR bushmaster. “get the fuck away from me im leaving what ever the hell this place is” he then sprung up and pushed the barrel of his ACR into my neck. “look if you want to get devoured by those runners be my guest buddy but dont go exposing this place to the infection” I looked at him like he was retarded “infection what infection and why the hell is the army bombing populated areas” he looked at me the same way. “ where were you 2 days ago ? There was a virus it was originally H1N1 but it evolved up to 10 times now its got Chicago by the balls and its spreading across the world as we speak turning everyone into animals devouring and ripping people to shreds and then the virus takes over the dead body and brings it back as a runner also know as a fresh undead body that has the ability to run or sometimes sprint god forbid but after 2-4 weeks without food the tissue breaks down from constant use without fuel and they start to get slow and shuffle around” my mind felt overwhelmed I wondered how my parents were doing in Dallas. “so what am I supped to do here but be a waste of space” he grinned. “well you obviously know how to use a weapon and our records say you have been in the military. you cant take care of yourself out there so we will make you part of out kill squad. “kill squad ?” “ohh shit you mean you have never killed or seen any infected yet ? that means your fresh you can be put to good use in our kill team” he told me his name was henry the specialist of his team kill team Charlie-mike. He directed me to the staff sergeant who looked at me and said “well well well we got some fresh meat hope you ready for 3 months of hard core trainin cuz this wont be easy now get yo ass in the garage and clean every APC tire the armory I think the kill teams ran over a little too much runners” 3 Months later........ the training was more rigorous than the basic military stuff a the armory where there was at least a 100 others conversing and grabbing into boxes of gear. Henry took me to the gunny of the armory where he helped me choose my gear. I picked up dragon skin Kevlar with implanted ceramic & alloy inserts. I took some gloves which I cut the fingers of. My boots where the basic digital camo color probably a left over from the war in Iraq which ended several years ago when our president simply drew the troops out. And European troops and some Russians finished off the big time terrorists soon after we heard no more from any our genocidal efforts finally payed off. I went to the weapon stand where I had to fill out a ID sheet to make sure they knew I had training with combat rifles. I chose the ACR which was in stock by the thousands as a gift from the weapon companies to the American army. I pulled all the safety clips and then grabbed a eotech scope out of a box and locked it onto the rail system of the weapon. I attached a mag pull the every one of my carbon strength reinforced clips. The gunny looked at me with a grin and we left for briefing. Chapter 4 things get messy we met up in the garage of the hospital every runner hunter of this kill force a total of 300 men and women in the huge elevated parking complex of the hospital, a general arrived in the elevator his chrome glasses shined in the evening light so did the many badges pinned on his suit which fit his old figure rather awkwardly. he had two formally dressed men with him they both had desert eagles on there side holsters but the general had a FN 2000 slung around his back. it was worn and scratched its polymer body was embedded with and insignia that I did not see so well as it was obscured by the scuffs and grime he looked at us and smiled his mouth opened and he flung his cigar off the ledge of the building he then begun and explained in a dominant voice. “there are 40 spec op Humvee's set up in formation ready to patrol the streets of Chicago you all will be in sector 6 the most dangerous sector of Chicago but no need to worry we have full fledged firepower of 4 APC's which will Carrie your kill team to your objectives take as much time as needed the runners arent going any where. you will clear the sears tower area a hot spot for runners. look all you men and woman, its time to revolt and fight back. its time to say we will not be scared, we will not be intimidated, we will win back our freedom!!” the whole complex light up with cheer. As the two men in formal wear took out PDA's and started directing people to there kill teams the first man shouted “ Chavez,Williams,buck, and,Samson go to APC #1” I quickly advanced thru the crowd to APC 1 I slowed my pace and saw its matte paint job of digital camo and its pop up dillan machine gun turret mounted on top. I pounded on its steel behind and its back door unlatched I stood waiting for the rest of my team I saw all three walking in a line towards the door I saw him ,the man with the kriss super V he smiled at me and said “no fuckin way you tha yankee we picked up in tha alley way you mad cus we killed your little runner girlfriend” I sprung towards him and grabbed his collar and punched him in the stomach then elbowed him in the mouth all the color drained out of his face. “ if you wouldn't of shot me with a fucking bean bag I would of blown your brains out back at the alley” he looked at me and with blood dripping down his mouth “i was just doing my job. welcome to foxtrot 3 by my names john samson you can just call me hunter” I let him go and he limped into the APC then another walked towards me he wore a Grey baklava and tight fitting clothing and a vest that barely covered his chest which awkwardly bulged out he walked towards me and took off the mask. She looked at m surprised face and said “what ? a woman cant be in the military” “well I..I...I just did not expect to have such a high rank personnel on our team” she looked at me and frowend “were both specialists grade one my names Kelly williams” “a heavily armored male in a hijab walked towards me playfully he came up to me and pulled off his hijab he was a African American . “hey specialist now look Im basically here to keep the moral you catch me ? I was in the navy im Ricky buckman Just call me squid now what do you want to go by kid?” I smiled “echo” “nice choice” Albert “echo” chavez I thought in my head I figured that sounds good. We all jumped in the APC while a kill team of rangers in a heavy Humvee with a mounted sentry gun rolled behind us as the whole convoy of kill force 6 prepared for battle. I thought about all my training aim for the head,short controlled bursts a shot anywhere else just stunned them. They move fast so they have to be neutralized if you get bitten or infected kill yourself with the poison capsule that was given or a team mate would do it. I grabbed a Kukri blade off the weapon rack that was provided in the APC I looked at its razor sharp edge its brushed steel surface reflected no light I sheathed it and strapped it to my leg. I caught the eye of Kelly who was fiddling around with the UAV control panel she looked at me and smiled. The APC's lights blinked red prompting us that we are in a hot zone. The APC vibrated as the co pilot took out a pack of runners with the Dillon remote controlled mini gun. We all loaded our weapons and packed up some ammo. Hunter and squid looked at each other and they bumped fists. I put a clip in my ACR and cocked it I turned on the eotech scope and strapped on my helmet and then slid on a black baklava. The APC driver prompted a alarm which was the signal that the door was opening, the big metal door slowly lowered its platform to the ground and we all got out Kelly was the last one out she grabbed that control panel and slid it into her bag she ran out and flipped the close button on the APC. We met up with the four other teams in our sector who already exited there Humvee's. A black Humvee that I never knew was in the convoy rode up and a military adviser jumped out and barked orders like some scared little dog and then jumped back in glad that he wasn't us. He positioned eight snipers on the roof who where each divided into teams of four they zip lined up the roofs and soon each team where picked up by two little bird helicopters the rest of us where on the ground either Humvee calvary hit teams or long range grenade support foxtrot was positioned on the magnificent mile at least it was magnificent. We cautiously walked down the street with another team of 6 watching our back and little birds with snipers covering us and telling us where the nearest pack is. It was empty until we got a report a pack of twenty runners where heading straight for us about 3 blocks away we had about a minute to prepare, snipers took out some and only six broke there steady aim and where 5 feet away, I drew my weapon and just before I could fire a Humvee rammed half the pack of runners over my team shot at there heads to finish them off . I stunted back and fell startled by a runner with broken legs dragging its smelly corpse towards me, my team did not even notice as they where pre occupied with finishing off the pack it grabbed my boot and pulled itself onto my chest I pushed it back and hunter tackled it and shot it once it grazed its ear he then rad up to it and curb stomped its head in over and over, like an egg it crunched under his boot he then walked towards me and picked me up and then our comm's screeched with a danger code: sector red REPEAT SECTOR RED!! this is not a drill!! squid looked at Kelly “OH shit radio the APC radio the APC!!” Kelly hastily radioed the APC and it arrived around the corner ASAP she got in and took the panel out of her backpack all the rangers got back in there Humvee's and formed up a line of vehicle's and the APC was in front we all jumped in and squid popped open 3 of the four combat hatches. We took stance and poked our body's out of the hatches while Kelly was typing away at the panel. “Kelly get us that predator drone NOW!!” “on it Echo..about.....NOW!! get ready for some boom boom boys” she said over the comm a predator drone deployed from a building somewhere and roared across the city's night sky. The little birds shot flares into out immediate area and the military advisor said nervously over the comm “formation green zone ASAP make space for one more hummer!!” his hummer screeched into our circle formation at the middle of the block intersection. We all could hear the uproar and the screaming rage of the Runners it was 9:00 PM and my stomach dropped as runners came at us from every angle swarming in between all the vehicles as we took out as much as we can the advisor yelled. “Break formation head for lane 3 of sector 5 Kelly yelled “but thats a dead end we have no where to go !!” “exactly now MOVE !!” we hastily rammed out way thru the crowd of runners it was easily about 200 to 300 runners we reached the street which was a dead end it was blocked by a collapsed building from all the beach bombing runs. We waited for 5 minutes until we saw it our doom three times as much runners appeared and headed for the convoy. The driver looked bewildered “Get ready im breaking position” he advanced the APC towards the crowd its massive tires gripping the rubble and concrete so agile and quick. He opened fire the Dillon mini gun until there was not one round left. the APC swiveled madly like a dog chasing its tail, all the blood and body matter stuck to the tire made it impossible to control. The whole interior rocked forward on impact with the flipped car. suddenly a screech and the APC flipped over on its side. the runners ignored the APC and went for the group of Humvee's ripping the rangers out that had not locked there Humvee door and devouring them. We herd the screams despite layer after layer of Kevlar and Armour of the APC. My radio started to squawk. “ Pindad Panser down repeat,flipped on its side calling in little bird for support !! bring in UH-60 shadow for medivac ASAP!” I groaned in pain the impact was hard,i could taste blood in my mouth my world was spinning. my team mates did not move they where all laying face down. I soon passed out Chapter 5 delta crimson “Delta crimson GO GO GO !!” I awoke in a sweat, I felt normal again I wiped my blood crusted face off. I leaned up and saw them. “Squid Kelly Hunter Your all alive !” hunter smiled “the crowds not givin up. Hurry mate we got to get outta this APC or crimson is just gonna have to save us” Crimson was an elite rescue squad of some of the best rescue force members in the military marines,rangers,green berets, you name em they can save you. Suddenly we heard the roar of helicopters. Then the door of the APC light up and blew of its hinges a soldier in a crimson baklava shined a light me and my team he latched two metal hooks onto our APC and then the helicopter lifted us into the air, this vehicle the best attack helicopter crafted by the engineer crew over at Hudson base they called it the Shadow because thats all it was, a quick killer in the night. A man made machine manufactured to kill and thats what it was best at. I broke for the chopper and jumped in then squid then Kelly it started to take off right before it left ground hunter grabbed the bay door and climbed in. “forgetting something ?” He threw me my ACR bushmaster which started to look like the generals FN 2000 it was scuffed and marked in every crack and crease. A crimson medivac specialist handed us some refreshments and snacks he said he picked it up at his last raid. He gave me some meds, adrenalin shots use them as a last resort of energy he said. I looked at squid who was holding his dog tag “ man echo you see how that APC flipped on us I almost crapped my pant's” I laughed at the joke even if its not funny my team needs the moral. I looked it the pilot he caught my stare. “where going to the main objective” I sighed and looked away hunter looked at me and made some type of hand signal. “hey Kelly you think we could of died back there” “easily hunter luckily the runners did not find our APC interesting” I looked over at Kelly who was looking at the cracked screen of the control panel. “hey Kelly what all did you use that panel for” “i saved the whole platoon with this thing while you where taking a nap, now its gone and base is a long fly away. The screen broke when the APC flipped. And the predator drone crashed without me controlling it” “damn, nothing good ever lasts long does it” “well echo thats not true your still alive aren't you ?” I we both smiled and when the happiness broke it was back to work. chapter 6 Raid The shadow landed on the roof of a building about 3 blocks away from objective R.R.T.R (runner ruled territory raid) our forces had to kill all runners and take back the sears tower. Kelly was stationed on the roof with hundreds of other snipers .with her barret M82 which ripped into 2 to 3 runners at a time with its large caliber amour piercing rounds. Military advisors sent Ground troops they marched the streets for the main attack on the R.R.T (runner ruled territory). Soldiers of all pact creed and faction marched side by side. the ISF (Iraqi Security Forces) the IRA (Irish Republican Army) even the CIA and DEA forces were marching along with whole police precincts including the bulk of the U.S military. This battle was inevitable and we are going to win.

Topic by albylovesscience    |  last reply


Im will create the 4wdrobot with lcd that show the obstacle and the distance cm help please the code?

/* 2011-10-03 robot4wd_06.pde Eric Pavey - www.akeric.com This software is released to the wild, free to be used and modified. If you use it, I just ask for some credit ;) Program to drive the 4wd robot chasis using an arduino paired up with a ping))) sensor and a servo for collision detection. Hardware: Arduino Duemilanove (but I'm sure any others will work) http://www.arduino.cc/en/Main/ArduinoBoardDuemilanove Arduino is powered off a 5xAA producing 7.5v, sitting in the belly of the chassis. Main chassis is the "4wd mobile platform" from DF Robot http://www.dfrobot.com/index.php?route=product/product&path=37&product_id=97 http://www.makershed.com/ProductDetails.asp?ProductCode=MKSEEED8 http://www.rugcommunity.org/page/dfrobot-4wd-arduino-mobile Motor control using the Adafruit motorshield: http://www.ladyada.net/make/mshield/index.html There doesn't seem to be API docs, but there is this header file: https://github.com/adafruit/Adafruit-Motor-Shield-library/blob/master/AFMotor.h Motor shield is powered off 4xC batteries (6v). Paralax ping))) : http://www.parallax.com/tabid/768/ProductID/92/Default.aspx http://www.arduino.cc/en/Tutorial/Ping Notes: I had to rewire the ribon connecting the ping to the motorshield: The ping's ribon is ground\+5v\signal, but the motorshield's input pins order are +5v\ground\signal. It works from 2cm to 3m. Paralax (Fubata) "standard servo": This is found in the "PING))) Mounting Bracket Kit": http://www.parallax.com/Store/Robots/RoboticAccessories/tabid/145/CategoryID/22/List/0/SortField/0/Level/a/ProductID/248/Default.aspx This is plugged into the 'servo2' port on the motorshield. It uses the servo library: http://arduino.cc/en/Reference/Servo Much of the ping code at the bottom is taken straight from the Arduino examples. */ //-------------------------------------------------------------------------- // Library include stuff: #include // needed for the motorshield. #include // motorshield needs this for running servos. #include LiquidCrystal lcd(3, 4, 5, 6, 11, 12); //-------------------------------------------------------------------------- // globals: // ping))) stuff: int g_pingPin = 19; // this is actually analog pin 5, pretending to be digital, on the motorshield. long g_collideDist = 50; // in cm, how far before collision mode kicks in? long g_cm = 300; // the current ping reading, just ana initial default. boolean g_checkLeft = false; // used for collision detection boolean g_checkRight = false; // used for collision detection boolean g_checkCenter = false; // used for collision detection int g_leftDist = 0; // used for collision detection int g_rightDist = 0; // used for collision detection // motor stuff: AF_DCMotor g_motor1(1, MOTOR12_8KHZ); // back left AF_DCMotor g_motor2(2, MOTOR12_8KHZ); // back right AF_DCMotor g_motor3(3, MOTOR12_8KHZ); // front right AF_DCMotor g_motor4(4, MOTOR12_8KHZ); // front left byte g_motorSpeed = 255; // max is 255 // Mode (state) stuff: byte g_mode = 1; // 1 = drive, 2 = proximity check, 3 = turning byte g_driveDir = -1; // 0 = stop, 1 = straight, 2 = right, 3 = left // servo stuff: Servo g_servo2; int g_servo2pin = 9; // servo2 uses digital pin 9, even though the docs say pin 10... int g_servoCenter = 98; // in degrees. 98 is straight ahead based on how I mounted the servo (it must be // a little inaccurate). full left is 180, full right is 0. // Servo is flipped upside down, fyi int g_servoRight = 135; // how far right? Max is 180, full right. int g_servoLeft = 45; // how far left? Min is 0, full left. // time stuff unsigned long g_time; // global time tracker unsigned long g_ptime; // global previous time tracker unsigned long g_elapsed = 0; // helps keeping track of framerate. unsigned long g_interval = 33; // in ms (about 30fps). This slows down the processing allowing the // multiple systems to play nicely together. Make this number smaller and it won't have enough // time for each state to run properly: The servo won't do a full sweep when scanning. unsigned long g_turnlength = 750; // in ms, how long to turn for. Since we don't know how far // it turns, we just guess on how long it should. The type of terrain turing on has a great // effect on what this should be. This value works well for my hardwood floors. unsigned long g_turnUntil; // used to track how long to turn. //-------------------------------------------------------------------------- // setup \ loop : void setup() { // Attach & center the servo: g_servo2.attach(g_servo2pin); g_servo2.write(g_servoCenter); // center it by default // Setup our framerate stuff g_time = millis(); g_ptime = g_time; } void loop() { // Main program entry point. // Need to keep the aiming and the piging at a fixed rate, or the closer the object gets // to the ping the faster it will aim, and do bad stuff. g_ptime = g_time; g_time = millis(); g_elapsed += g_time - g_ptime; // Wait for the proper amount of time to pass before we do anything: if(g_elapsed < g_interval){ return; } else{ g_elapsed = 0; } // Do stuff, based on the current mode: if(g_mode == 1){ g_cm = ping(); // sometimes the sensor returns a 0 value that can foul up things :( if(g_cm > g_collideDist || g_cm == 0){ // If there is nothing in our way, drive! if(g_driveDir != 1){ g_driveDir = 1; move(g_driveDir); } } else{ // if we're too close to something, stop the motors and switch to 'proximity check' mode: if(g_driveDir != 0){ g_driveDir = 0; move(g_driveDir); } // initialize the proximity check stuff: g_checkLeft = false; g_checkRight = false; g_checkCenter = false; g_leftDist = 0; g_rightDist = 0; // switch to mode 2: g_mode = 2; } } else if(g_mode == 2){ // Do proximity check! boolean checked = proximityCheck(); if(checked){ // Define which direction to turn. // If the right distance is greater than the left distance, turn that direction, // otherwise go the other way: if(g_rightDist >= g_leftDist){ g_driveDir = 2; } else{ g_driveDir = 3; } // now that we've set which direction to turn, start timing how long the turn // has taken, and switch to mode 3. g_turnUntil = millis() + g_turnlength; g_mode = 3; } } else if(g_mode == 3){ // We must be turning! The logic for switching to other modes is in that function. turn(); } } //-------------------------------------------------------------------------- // Helper functions: void turn(){ // Executed when g_mode == 3 // Used to turn the robot. if (millis() < g_turnUntil){ // keep'on turning... move(g_driveDir); } else{ // If we're done turning, see if there is anything still in our way: g_cm = ping(); // sometimes the sensor returns a 0 value that can foul up things :( if(g_cm > g_collideDist || g_cm == 0){ // If there is nothing in our way go back to mode 1: g_mode = 1; } else{ // If stuff is still in our way, turn more in the same direction until // not blocked: g_turnUntil = millis() + g_turnlength; } } } boolean proximityCheck(){ // Used when mode == 2: Swing the ping left and right taking readings to // find which way is safe to go. Returns false when in the middle of the check // operation, returns true when entire check process is complete. // Current angle of the servo: float angle = g_servo2.read(); // check left first: ( full left is 0 deg) if(g_checkLeft == false){ if(angle > g_servoLeft){ g_servo2.write(angle-10) ; return false; } else{ g_checkLeft = true; g_leftDist = ping(); return false; } } // check right second: ( full right is 180 deg) if(g_checkLeft == true && g_checkRight == false){ if(angle < g_servoRight){ g_servo2.write(angle+10) ; return false; } else{ g_checkRight = true; g_rightDist = ping(); return false; } } // Go to center position third: if(g_checkLeft == true && g_checkRight == true && g_checkCenter == false){ if(angle != g_servoCenter){ g_servo2.write(angle-10) ; return false; } else{ g_checkCenter = true; return false; } } // Finally if we've checked left, right, and got back to center, return true // to tell the later code that the full check is complete: if(g_checkLeft == true && g_checkRight == true && g_checkCenter == true){ return true; } else{ return false; } } void move(byte mode){ // This function moves the wheels. Can be called to when mode == 1 (driving) or 3 (turning). if(mode == 0){ // all stop! g_motor1.setSpeed(0); g_motor2.setSpeed(0); g_motor3.setSpeed(0); g_motor4.setSpeed(0); } else{ // full speed! g_motor1.setSpeed(g_motorSpeed); g_motor2.setSpeed(g_motorSpeed); g_motor3.setSpeed(g_motorSpeed); g_motor4.setSpeed(g_motorSpeed); // full speed, but which direction? if(mode == 1){ // go straight g_motor1.run(FORWARD); g_motor2.run(FORWARD); g_motor3.run(FORWARD); g_motor4.run(FORWARD); } else if(mode == 2){ // turn right g_motor1.run(FORWARD); g_motor2.run(BACKWARD); g_motor3.run(BACKWARD); g_motor4.run(FORWARD); } else if (mode == 3){ // turn left g_motor1.run(BACKWARD); g_motor2.run(FORWARD); g_motor3.run(FORWARD); g_motor4.run(BACKWARD); } } } float ping(){ // Returns the distance in cm from the ping sensor. Pulled from // Arduino docs. // The PING))) is triggered by a HIGH pulse of 2 or more microseconds. // Give a short LOW pulse beforehand to ensure a clean HIGH pulse: pinMode(g_pingPin, OUTPUT); digitalWrite(g_pingPin, LOW); delayMicroseconds(2); digitalWrite(g_pingPin, HIGH); delayMicroseconds(5); digitalWrite(g_pingPin, LOW); // The same pin is used to read the signal from the PING))): a HIGH // pulse whose duration is the time (in microseconds) from the sending // of the ping to the reception of its echo off of an object. pinMode(g_pingPin, INPUT); long duration = pulseIn(g_pingPin, HIGH); float cm = microsecondsToCentimeters(duration); return cm; } long microsecondsToCentimeters(long microseconds){ // Simple conversion setp, kept as a function simply to illustrate // how it works. Pulled from Arduino docs. // The speed of sound is 340 m/s or 29 microseconds per centimeter. // The ping travels out and back, so to find the distance of the // object we take half of the distance travelled. //return microseconds / 29 / 2; return microseconds / 58; } // while(val == HIGH) { // Loop until pin reads a high value //val = digitalRead(ultraSoundSignal); //timecount = timecount +1; // Count echo pulse time} //ultrasoundValue = timecount; // Append echo pulse time to ultrasoundValue //lcd.clear(); //lcd.setCursor(0,0); //lcd.print("OBSTAKEL cm "); //lcd.print(timecount/10); //delay(200); //if(timecount > 0){ //digitalWrite(ledPin, HIGH);}

Question by pe2hlc    |  last reply


i will the 4wdrobot with lcd that show the obstacle and the distance cm help please the code?

/*  2011-10-03  robot4wd_06.pde  Eric Pavey - www.akeric.com  This software is released to the wild, free to be used and modified.  If you use it,  I just ask for some credit ;)    Program to drive the 4wd robot chasis using an arduino paired up with a ping))) sensor  and a servo for collision detection.    Hardware:    Arduino Duemilanove (but I'm sure any others will work)  http://www.arduino.cc/en/Main/ArduinoBoardDuemilanove  Arduino is powered off a 5xAA producing 7.5v, sitting in the belly of the chassis.    Main chassis is the "4wd mobile platform" from DF Robot  http://www.dfrobot.com/index.php?route=product/product&path;=37&product;_id=97  http://www.makershed.com/ProductDetails.asp?ProductCode=MKSEEED8  http://www.rugcommunity.org/page/dfrobot-4wd-arduino-mobile    Motor control using the Adafruit motorshield:  http://www.ladyada.net/make/mshield/index.html  There doesn't seem to be API docs, but there is this header file:  https://github.com/adafruit/Adafruit-Motor-Shield-library/blob/master/AFMotor.h  Motor shield is powered off 4xC batteries (6v).    Paralax ping))) :   http://www.parallax.com/tabid/768/ProductID/92/Default.aspx  http://www.arduino.cc/en/Tutorial/Ping  Notes:  I had to rewire the ribon connecting the ping to the motorshield:  The  ping's ribon is ground\+5v\signal, but the motorshield's input pins order are +5v\ground\signal.  It works from 2cm to 3m.    Paralax (Fubata) "standard servo":  This is found in the "PING))) Mounting Bracket Kit":  http://www.parallax.com/Store/Robots/RoboticAccessories/tabid/145/CategoryID/22/List/0/SortField/0/Level/a/ProductID/248/Default.aspx  This is plugged into the 'servo2' port on the motorshield.  It uses the servo library:  http://arduino.cc/en/Reference/Servo    Much of the ping code at the bottom is taken straight from the Arduino examples.  */ //-------------------------------------------------------------------------- // Library include stuff: #include   // needed for the motorshield. #include   // motorshield needs this for running servos. #include LiquidCrystal lcd(3, 4, 5, 6, 11, 12); //-------------------------------------------------------------------------- // globals: // ping))) stuff: int g_pingPin = 19; // this is actually analog pin 5, pretending to be digital, on the motorshield. long g_collideDist = 50; // in cm, how far before collision mode kicks in? long g_cm = 300; // the current ping reading, just ana initial default. boolean g_checkLeft = false; // used for collision detection boolean g_checkRight = false; // used for collision detection boolean g_checkCenter = false; // used for collision detection int g_leftDist = 0;  // used for collision detection int g_rightDist = 0;  // used for collision detection // motor stuff: AF_DCMotor g_motor1(1, MOTOR12_8KHZ); // back left AF_DCMotor g_motor2(2, MOTOR12_8KHZ); // back right AF_DCMotor g_motor3(3, MOTOR12_8KHZ); // front right AF_DCMotor g_motor4(4, MOTOR12_8KHZ); // front left byte g_motorSpeed = 255; // max is 255 // Mode (state) stuff: byte g_mode = 1; // 1 = drive, 2 = proximity check, 3 = turning byte g_driveDir = -1; // 0 = stop, 1 = straight, 2 = right, 3 = left // servo stuff: Servo g_servo2; int g_servo2pin = 9; // servo2 uses digital pin 9, even though the docs say pin 10... int g_servoCenter = 98; // in degrees.  98 is straight ahead based on how I mounted the servo (it must be     // a little inaccurate).  full left is 180, full right is 0.     // Servo is flipped upside down, fyi int g_servoRight = 135; // how far right?  Max is 180, full right. int g_servoLeft = 45; // how far left?  Min is 0, full left. // time stuff unsigned long g_time;  // global time tracker unsigned long g_ptime;  // global previous time tracker unsigned long g_elapsed = 0;  // helps keeping track of framerate. unsigned long g_interval = 33; // in ms (about 30fps).  This slows down the processing allowing the     // multiple systems to play nicely together.  Make this number smaller and it won't have enough     // time for each state to run properly:  The servo won't do a full sweep when scanning. unsigned long g_turnlength = 750; // in ms, how long to turn for.  Since we don't know how far     // it turns, we just guess on how long it should.  The type of terrain turing on has a great     // effect on what this should be.  This value works well for my hardwood floors. unsigned long g_turnUntil; // used to track how long to turn. //-------------------------------------------------------------------------- // setup \ loop : void setup() {   // Attach & center the servo:   g_servo2.attach(g_servo2pin);   g_servo2.write(g_servoCenter);  // center it by default   // Setup our framerate stuff   g_time = millis();   g_ptime = g_time; } void loop() {   // Main program entry point.     // Need to keep the aiming and the piging at a fixed rate, or the closer the object gets   // to the ping the faster it will aim, and do bad stuff.   g_ptime = g_time;   g_time = millis();   g_elapsed += g_time - g_ptime;   // Wait for the proper amount of time to pass before we do anything:   if(g_elapsed < g_interval){     return;   }   else{     g_elapsed = 0;   }   //  Do stuff, based on the current mode:   if(g_mode == 1){     g_cm = ping();     // sometimes the sensor returns a 0 value that can foul up things :(     if(g_cm > g_collideDist || g_cm == 0){       // If there is nothing in our way, drive!       if(g_driveDir != 1){         g_driveDir = 1;         move(g_driveDir);       }     }     else{       // if we're too close to something, stop the motors and switch to 'proximity check' mode:       if(g_driveDir != 0){         g_driveDir = 0;         move(g_driveDir);       }       // initialize the proximity check stuff:       g_checkLeft = false;       g_checkRight = false;       g_checkCenter = false;       g_leftDist = 0;       g_rightDist = 0;        // switch to mode 2:       g_mode = 2;        }   }   else if(g_mode == 2){     // Do proximity check!     boolean checked = proximityCheck();      if(checked){       // Define which direction to turn.       // If the right distance is greater than the left distance, turn that direction,       // otherwise go the other way:       if(g_rightDist >= g_leftDist){         g_driveDir = 2;       }       else{         g_driveDir = 3;       }       // now that we've set which direction to turn, start timing how long the turn       // has taken, and switch to mode 3.       g_turnUntil = millis() + g_turnlength;       g_mode = 3;     }   }   else if(g_mode == 3){     // We must be turning!  The logic for switching to other modes is in that function.     turn();   } } //-------------------------------------------------------------------------- // Helper functions: void turn(){   // Executed when g_mode == 3   // Used to turn the robot.     if (millis() < g_turnUntil){     // keep'on turning...     move(g_driveDir);   }    else{     // If we're done turning, see if there is anything still in our way:     g_cm = ping();     // sometimes the sensor returns a 0 value that can foul up things :(     if(g_cm > g_collideDist || g_cm == 0){       // If there is nothing in our way go back to mode 1:       g_mode = 1;     }     else{       // If stuff is still in our way, turn more in the same direction until       // not blocked:       g_turnUntil = millis() + g_turnlength;     }   } } boolean proximityCheck(){   // Used when mode == 2:  Swing the ping left and right taking readings to   // find which way is safe to go.  Returns false when in the middle of the check   // operation, returns true when entire check process is complete.     // Current angle of the servo:   float angle = g_servo2.read();     // check left first: ( full left is 0 deg)   if(g_checkLeft == false){     if(angle > g_servoLeft){       g_servo2.write(angle-10) ;       return false;        }     else{       g_checkLeft = true;       g_leftDist = ping();       return false;       }   }   // check right second: ( full right is 180 deg)   if(g_checkLeft == true && g_checkRight == false){     if(angle < g_servoRight){       g_servo2.write(angle+10) ;       return false;          }        else{       g_checkRight = true;       g_rightDist = ping();       return false;     }   }   // Go to center position third:   if(g_checkLeft == true && g_checkRight == true && g_checkCenter == false){     if(angle != g_servoCenter){       g_servo2.write(angle-10) ;       return false;     }           else{       g_checkCenter = true;       return false;     }   }   // Finally if we've checked left, right, and got back to center, return true   // to tell the later code that the full check is complete:   if(g_checkLeft == true && g_checkRight == true && g_checkCenter == true){     return true;   }   else{     return false;   } } void move(byte mode){   // This function moves the wheels.  Can be called to when mode == 1 (driving) or 3 (turning).   if(mode == 0){     // all stop!     g_motor1.setSpeed(0);     g_motor2.setSpeed(0);     g_motor3.setSpeed(0);     g_motor4.setSpeed(0);   }   else{     // full speed!     g_motor1.setSpeed(g_motorSpeed);     g_motor2.setSpeed(g_motorSpeed);     g_motor3.setSpeed(g_motorSpeed);     g_motor4.setSpeed(g_motorSpeed);         // full speed, but which direction?     if(mode == 1){       // go straight       g_motor1.run(FORWARD);       g_motor2.run(FORWARD);       g_motor3.run(FORWARD);       g_motor4.run(FORWARD);     }     else if(mode == 2){       // turn right       g_motor1.run(FORWARD);       g_motor2.run(BACKWARD);       g_motor3.run(BACKWARD);       g_motor4.run(FORWARD);      }     else if (mode == 3){       // turn left       g_motor1.run(BACKWARD);       g_motor2.run(FORWARD);       g_motor3.run(FORWARD);       g_motor4.run(BACKWARD);     }   } } float ping(){   // Returns the distance in cm from the ping sensor.  Pulled from   // Arduino docs.     // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.   // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:   pinMode(g_pingPin, OUTPUT);   digitalWrite(g_pingPin, LOW);   delayMicroseconds(2);   digitalWrite(g_pingPin, HIGH);   delayMicroseconds(5);   digitalWrite(g_pingPin, LOW);   // The same pin is used to read the signal from the PING))): a HIGH   // pulse whose duration is the time (in microseconds) from the sending   // of the ping to the reception of its echo off of an object.   pinMode(g_pingPin, INPUT);   long duration = pulseIn(g_pingPin, HIGH);    float cm = microsecondsToCentimeters(duration);   return cm; } long microsecondsToCentimeters(long microseconds){   // Simple conversion setp, kept as a function simply to illustrate   // how it works.  Pulled from Arduino docs.     // The speed of sound is 340 m/s or 29 microseconds per centimeter.   // The ping travels out and back, so to find the distance of the   // object we take half of the distance travelled.   //return microseconds / 29 / 2;   return microseconds / 58; }          // while(val == HIGH) {                  // Loop until pin reads a high value //val = digitalRead(ultraSoundSignal); //timecount = timecount +1;             // Count echo pulse time} //ultrasoundValue = timecount;          // Append echo pulse time to ultrasoundValue //lcd.clear(); //lcd.setCursor(0,0); //lcd.print("OBSTAKEL  cm "); //lcd.print(timecount/10); //delay(200); //if(timecount > 0){ //digitalWrite(ledPin, HIGH);}    

Question by pe2hlc    |  last reply