Ultrasound Cleaning

For maintenance purposes, I would like to construct an ultrasound cleaning tank. Preferably an encapsulated ultrasound transducer and generator that could be used in an old solvent cleaning tank which now should not be used. From reading a little about the subject, its application would find a wide use as a clean and environmentally friendly solution in many industrial and domestic applications. Is it feasable and cost effective to build a generator and an encapsulated transducer, and are there any websites to go to to find out more?

Topic by brianeggar 11 years ago


Ultrasound/sonogram

Hello folks my lady has recently become pregnant and we were looking for ultrasound equipment just because it's pretty cool and something I think should be pretty available for everyone now. However renting them is over £90 a week and I think buying them is very expensive so basically I am wondering if there is a way to make one or at least attempt this. How would I go about it? I understand the theory on how it works but would like to know the technology involved and how to make it as cheaply as possible, or if it's possible.

Question by AdamS550 1 year ago  |  last reply 1 year ago


Ultrasound 3D positioning

How would you use an array of ultrasonic sensors to determine the 3d position of an ultrasonic transmitter. Basically i want an ultrasound transmitter on my hand that gets picked up on an array of 5 or so receivers that outputs the position via usb.

Topic by redshirtdeath 8 years ago  |  last reply 8 years ago


Changing the frequency of Ultrasound Massager ?

Is it possible to convert one of those existing portable Ultrasound unit thats use ( 1- 3 mhz ) to lower frequencies i.e.  35 - 350 khz  or build one form scratch ? thanks hele

Topic by hele 8 years ago  |  last reply 8 years ago


How can i image ultrasound , using PIC or any other DIY ?

Can i image ultrasound using microcontroller ? there are PC-based hand-held ultrasound devices in tha market already , but there is no instructable how to make one of them yet .there is a link , herehttp://www.ele.uva.es/~jesus/sonar/sonar.htmlany idea what software and circuit that guy is using ? and how toimprove it ?any DIY ar links that would help methank you

Question by lu2a 10 years ago  |  last reply 4 years ago


Is there a way to make an ultrasound-to-sound "audio spotlight" DIY?

Http://en.wikipedia.org/wiki/Sound_from_ultrasoundThe Holosonics Audio Spot Light sells for $2,500, and the competing Sennhieser AudioBeam sells for $4,500.Is it possible to do something like this home-made?

Question by endolith 10 years ago  |  last reply 1 year ago


does anyone know of a good ultrasonic sound emitter i can make?

Working something that found in some old text to test a theory but need a nice small hand held design for a ultrasonic sound emitter where the frequencies can be altered by the turn of a knob can anyone help please direct me to a good link either here or to some other sight.

Question by maskofdarkness22 6 years ago  |  last reply 6 years ago


Ground Penetrating Gadget

Hello, out there, I would like to find how to build a ground penetrating gadget. I think there are a lot of 'us' would like to have something that can 'peek' underneath the surface of the ground, not necessary very deep. For example, such a gadget that can help fossil hunting tremandously. And it does NOT have to go all the way to Ground Penetrating Radar. As long as it can detect the differences between the matrix and interested object up to say 50 cm in depth, it will be good enough. And it doesn't matter what physical principle is used: GPR, ultrasound, electrical resistance or capacitance, ... (whatever). What I have in mind in such gadget would be tied to one of the shoes (so, it must be very light weight), using wifi to transmit the signal to iPad/iPhone so that the user can just walk and know the place to dig. Any help or comment will be greatly appreciated.

Topic by DinoDragon 7 years ago  |  last reply 3 years ago


Sonic data transmission?

This is just an idle thought, but I was reading a couple of ROV builds, and the one thing they all have in common is a tether - it's a fact of the world that very little in the way of radio signal can penetrate water. So... Could you send control signals to an ROV via sound or ultrasound?  Could beeps and clicks carry enough data, far enough, and clearly enough, to control an ROV? Even more fun, how much data could come back? Sensor readings? Images? Just throwing it out there for you to toy with, but it would be fun to have genuinely-remote control for this class of robot.

Topic by Kiteman 3 years ago  |  last reply 3 years ago


Variable 3D Proximity/Distance Sensor With Feelings : what to and how to

Greetings, I would like to know if there is a simple way to create a Variable 3D Proximity/Distance Sensor. When you think about "Proximity Sensor" you think about "Infrared", but IR proximity sensors only ''scan" a straight line and not a whole spheric space, so that is not the answer. Detail 1: 3-dimensionality Imagine this: We have object A and object B. Object A has the sensor. Object A would sense object B's distance to itself (A) regardless of the relative position between the two objects - it wouldn't matter if B was in front of A, if it was on top of A, if it was behind A, etc. Detail 2: Variability The sensor would sense a variable proximity/distance. It would know if the two objects were 1cm apart, π cm apart, 12cm apart, 50cm apart, etc. Detail 3: Feelings :3 (Oh, Teh Loev) Imagine again objects A and B. Object A would only sense Object B's distance to itself. Not it's distance to a table, nor a wall nor your cat. Like if only Object A and Object B existed. Here's the catch: both objects would have the sensor and they would sense eachother (again, not anything else), so I can't use 'things' that would interfere with eachother (like, I don't know, isn't there something like the adding of sound waves[read phrase bellow]? I'm only a high-school student...). I thought about using sound waves (because they spread 3-dimensionally), but I don't know how I could implement that... Outcome This is an example of what the sensors could be used to after having the sensors built and the code written: 1: Object A senses B. Object B senses A. 2: If B is 50cm apart from self (A), light LED1. If A is 50cm apart from self (B), light LED1. 3: If B is 20cm apart from self (A), light LED2. If A is 20cm apart from self (B), light LED2. 4: If B is 5cm apart from selft (A), light LED3. If A is 5cm apart from self (B), light LED3. As you can see, in this example both objects would do exactly the same... Sooo.... How can I make such a PAIR of sensors that wouldn't interfere with eachother? P.S.: I'm talking about making a circuit of my own or buying a sensor and implementing it in an external circuit of my own or whatever... Thanks a lot.

Question by pedrotome 9 years ago  |  last reply 9 years ago


How can a sonar/ultrasound pest control unit be DIY? Answered

I've seen ads for pest control units that transmit some sort of signal that drives bugs &rodents away... friend had one & she didn't even get flies... but not sure which ones really work, and so expensive..... Would love to find a DIY Instructable on this! It would save money, the environment...etc...

Question by StarrsWife 10 years ago  |  last reply 1 year ago


Connecting sensors and GSM modem to arduino board

Can someone please instruct me on how to correctly configure either an infrared sensor or ultrasound sensor and GSM modem on the arduino board and how to program to receive alerts on my mobile.

Question by chekwech 2 months ago  |  last reply 2 months ago


Echo Location / Arduino / Michropones

Hello guys, So, I´d aprecciate if you could give me any ideas about echo location using microphones or ultrasound detectors, the idea is to put three or four sound detectors and put any object in the middle so that way because of the sound I could know where the object is, by using the detectors

Topic by JoséG100 3 years ago  |  last reply 3 years ago


unidirectional audio speaker. Design discussion

I was thinking of designing a unidirectional speaker driver circuit. As far as I know ,I need to drive the speakers with audio signal with ultrasound carrier wave... I thought of making a circuit that generates 20/16 Mhz (1.25mhz) square wave? using 4060 ic and 20 mhz crystal and using optocouplers to torn on and off the speakers at same frequency. do you think it is going to work?

Topic by Suraj Grewal 3 years ago


What sensor should I use to sense the distance of an unknown object? Answered

Hello, I'm trying to put together a project for the first time with an arduino uno board. The aim of my project is to sense the distance/position/proximity of ANY object away from my sensor (board). Ideally, I want a system that is able to give good reading if the system is operating out-doors. The entire system is housed inside a box with only the power line coming out of it. The cost of the system should be cheap enough for a small, hobby project. The range of the sensor should be about 2cm to 3m. I've looked at IR, ultrasound, and hall-effect sensors. They're not really what I need because 1. IR sensor doesn't work well out-doors 2. Ultrasound sensor has to be exposed outside of a container to send out the sound waves. 3. Hall-effect sensor needs the object being detected to have a magnet attached to it. So are there other options I can go with?? A different kind of magnetic sensor where if the magnetic field it produced was disrupted by an unknown object, the sensor can give me back a distance reading of that object?

Question by petergeng28 6 years ago  |  last reply 6 years ago


I need help with arduino code. Can someone help me remove the ping sensor from the code below?

I need to take the ping sensor out of this code. I want the robot to drive around like crazy until it bumps into something with the bump switch. /* Rumblebot Driving with object avoidance utiliszing PING Ultrasound Sensor * and a bump switch. * Reads values (00014-01199) from an ultrasound sensor (Parallax PING) * * Version 1.1.2 Motor runs and drives full time unless object detected. *-------------------------------------------------------------------- * * * * * * */ int switchPin= 2; // Right bump switch on pin 2 int swval; // Variable for reading switch status int ultraSoundSignal = 7; // Ultrasound signal pin int val = 0; int ultrasoundValue = 0; int timecount = 0; // Echo counter int ledPin = 13; // LED connected to digital pin 13 int motorpinright = 10; // pin for left motor reverse int motorpinleft = 11; // pin for left motor forward int motorpinrevright = 5; // pin for right motor reverse int motorpinrevleft = 6; // pin for right motor forward void setup() { pinMode(switchPin, INPUT); // Sets the digital pin as input pinMode(ledPin, OUTPUT); // Sets the digital pin as output pinMode(motorpinright, OUTPUT); // Motor drives----------- pinMode(motorpinleft, OUTPUT); //------------------------ pinMode(motorpinrevright, OUTPUT); //------------------------ pinMode(motorpinrevleft, OUTPUT); //------------------------ } void loop() { /* Start Scan * -------------------------------------------------- */{ timecount = 0; val = 0; pinMode(ultraSoundSignal, OUTPUT); // Switch signalpin to output /* Send low-high-low pulse to activate the trigger pulse of the sensor * ------------------------------------------------------------------- */ digitalWrite(ultraSoundSignal, LOW); // Send low pulse delayMicroseconds(2); // Wait for 2 microseconds digitalWrite(ultraSoundSignal, HIGH); // Send high pulse delayMicroseconds(5); // Wait for 5 microseconds digitalWrite(ultraSoundSignal, LOW); // Holdoff /* Listening for echo pulse * ------------------------------------------------------------------- */ pinMode(ultraSoundSignal, INPUT); // Switch signalpin to input val = digitalRead(ultraSoundSignal); // Append signal value to val while(val == LOW) { // Loop until pin reads a high value val = digitalRead(ultraSoundSignal); } while(val == HIGH) { // Loop until pin reads a high value val = digitalRead(ultraSoundSignal); timecount = timecount +1; // Count echo pulse time } /* Lite up LED if any value is passed by the echo pulse * ------------------------------------------------------------------- */ if(timecount > 0){ digitalWrite(ledPin, HIGH); delay(50); //LED on for 50 microseconds digitalWrite(ledPin, LOW); } /* Delay of program * ------------------------------------------------------------------- */ delay(100); } /* Action based on data * ------------------------------------------------------------------- */ { ultrasoundValue = timecount; // Append echo pulse time to ultrasoundValue } if (ultrasoundValue > 800) { /* Drive straight forward *----------------------------------------------- */ analogWrite(motorpinleft, 255); //100% speed analogWrite(motorpinright, 255); //100% speed0 } /*------------------------------------------------ */ else /* Turn hard right *--------------------------------------------- */ { analogWrite(motorpinleft, 0); //stop left motor analogWrite(motorpinright, 0); //stop right motor analogWrite(motorpinrevright, 0); // stop right rev motor analogWrite(motorpinrevleft, 0); // stop left rev motor analogWrite(motorpinrevright, 255); //100% speed analogWrite(motorpinleft, 255); //100% speed delay(380); //380 milliseconds analogWrite(motorpinrevright, 0); // off analogWrite(motorpinleft, 0); // off /*---------------------------------------------- */ } /* Backup and turn right when switch gets bumped and closes circuit to ground *--------------------------------------------------- */ /* */ digitalWrite(switchPin, HIGH); // Sets the pin to high swval = digitalRead(switchPin); // Read input value and store it if (swval == LOW) { analogWrite(motorpinleft, 0); //stop left motor analogWrite(motorpinright, 0); //stop right motor analogWrite(motorpinrevleft, 0); // stop left rev motor analogWrite(motorpinrevright, 0); // stop right rev motor analogWrite(motorpinrevleft, 255); //100% speed analogWrite(motorpinrevright, 255); //100% speed delay(800); //800 milliseconds analogWrite(motorpinrevleft, 0); // off analogWrite(motorpinrevright, 0); // off analogWrite(motorpinrevright, 255); //100% reverse speed analogWrite(motorpinleft, 255); //100% forward speed delay(700); //700 milliseconds analogWrite(motorpinrevright, 0); // off analogWrite(motorpinleft, 0); // off delay(50); //50 milliseconds } /*------------------------------------------------ */ } UPDATE I tried deleting some stuff and changing some stuff. When I turn on the robot noting happens. Here is the code after the changes. * Rumblebot Driving with object avoidance utiliszing PING Ultrasound Sensor * and a bump switch. * Reads values (00014-01199) from an ultrasound sensor (Parallax PING) * * Version 1.1.2 Motor runs and drives full time unless object detected. *-------------------------------------------------------------------- * * * * * * */ int switchPin= 2; // Right bump switch on pin 2 int swval; // Variable for reading switch status int ultraSoundSignal = 7; // Ultrasound signal pin int val = 0; int ultrasoundValue = 0; int timecount = 0; // Echo counter int ledPin = 13; // LED connected to digital pin 13 int motorpinright = 10; // pin for left motor reverse int motorpinleft = 11; // pin for left motor forward int motorpinrevright = 5; // pin for right motor reverse int motorpinrevleft = 6; // pin for right motor forward void setup() { pinMode(switchPin, INPUT); // Sets the digital pin as input pinMode(ledPin, OUTPUT); // Sets the digital pin as output pinMode(motorpinright, OUTPUT); // Motor drives----------- pinMode(motorpinleft, OUTPUT); //------------------------ pinMode(motorpinrevright, OUTPUT); //------------------------ pinMode(motorpinrevleft, OUTPUT); //------------------------ } void loop() { /* Start Scan * -------------------------------------------------- */{ timecount = 0; val = 0; pinMode(ultraSoundSignal, OUTPUT); // Switch signalpin to output /* Send low-high-low pulse to activate the trigger pulse of the sensor /* Delay of program * ------------------------------------------------------------------- */ delay(100); } /* Action based on data * ------------------------------------------------------------------- */ { ultrasoundValue = timecount; // Append echo pulse time to ultrasoundValue } if (true) { /* Drive straight forward *----------------------------------------------- */ analogWrite(motorpinleft, 255); //100% speed analogWrite(motorpinright, 255); //100% speed0 } /*------------------------------------------------ */ else /* Turn hard right *--------------------------------------------- */ { analogWrite(motorpinleft, 0); //stop left motor analogWrite(motorpinright, 0); //stop right motor analogWrite(motorpinrevright, 0); // stop right rev motor analogWrite(motorpinrevleft, 0); // stop left rev motor analogWrite(motorpinrevright, 255); //100% speed analogWrite(motorpinleft, 255); //100% speed delay(380); //380 milliseconds analogWrite(motorpinrevright, 0); // off analogWrite(motorpinleft, 0); // off /*---------------------------------------------- */ } /* Backup and turn right when switch gets bumped and closes circuit to ground *--------------------------------------------------- */ /* */ digitalWrite(switchPin, HIGH); // Sets the pin to high swval = digitalRead(switchPin); // Read input value and store it if (swval == LOW) { analogWrite(motorpinleft, 0); //stop left motor analogWrite(motorpinright, 0); //stop right motor analogWrite(motorpinrevleft, 0); // stop left rev motor analogWrite(motorpinrevright, 0); // stop right rev motor analogWrite(motorpinrevleft, 255); //100% speed analogWrite(motorpinrevright, 255); //100% speed delay(800); //800 milliseconds analogWrite(motorpinrevleft, 0); // off analogWrite(motorpinrevright, 0); // off analogWrite(motorpinrevright, 255); //100% reverse speed analogWrite(motorpinleft, 255); //100% forward speed delay(700); //700 milliseconds analogWrite(motorpinrevright, 0); // off analogWrite(motorpinleft, 0); // off delay(50); //50 milliseconds } /*------------------------------------------------ */ }

Question by TOCO 8 years ago  |  last reply 8 years ago


Diy Spot Welder

Hello, this is my first post here at Instructables. I will get straight to the point. I plan to build a diy spot welder. However, in most of the diy spot welder projects I have looked at, including Hack a Day and Instructables, a MOT (Microwave Oven Transformer) is used. The secondary is rewound with thicker wire, and the transformer is used to step down voltage and step up current. I have heard that these transformers can supply as much as a kiloamp at very low voltages. However, I do not own a MOT, they are too costly to buy, and I do not want to retrieve one from a microwave because- A) Nobody happens to be throwing away a microwave in my area. B)The guys who own the scrap metal and thrown away appliances will only give me a microwave oven at a hefty price. C)I would prefer to live a very long life, and do not want to gt myself electrocuted poking around the innards of a microwave. SO, I did a thorough search, and found that some people made a welder from a stereo amp transformer. Again, I did not own one, but what I did own was an ultrasound generator that was supposed to drive away rats. After making  bloody inroads into it`s innards, I found a transformer quite a bit larger than the regular step downs. It is 5 cm long, 4 cm wide and 1.7 cm tall.  Input voltage is 220 volt AC from the mains, at 60 hertz. Output is 12 volt AC at a maximum of 300 MA. Speaking from experience would anybody please tell me whether this is suitable for a spot welder? Please ask me for additional information, including pictures, if required. Thank you.

Topic by TheLightningConductor 2 years ago  |  last reply 2 years ago


Can Someone Modify an Arduino Sketch For Me? Answered

I recently got into Arduino, and my first long term project is an autonomous roaming robot. Now, I've been in electronics for a while, so the actual building of the thing was not a problem....but the programming is. I've found a couple examples of codes online, but they all use Sharp IR sensors, whereas I have a Ping))) Ultrasonic sensor. I was wondering if there were any Arduino experts out there that could modify a sketch that I found to only use the Ping))) instead of the IR sensor(s). This sketch actually uses both, and would be perfect if the Ping))) was used in place of the IR sensors, rather than with them. If anybody could modify the sketch below to do as I said, your help would be greatly appreciated. Thanks. Code: int micVal; int cdsVal; int irLval;  // Left IR int irCval;  // Center IR int irRval;  // Right IR int i;   // Generic Counter int x;  // Generic Counter int PLval;  // Pulse Width for Left Servo int PRval;  // Pulse Width for Right Servo int cntr;  // Generic Counter Used for Determining amt. of Object Detections int counter; // Generic Counter int clrpth;  // amt. of Milliseconds Of Unobstructed Path int objdet;  // Time an Object was Detected int task;  // Routine to Follow for Clearest Path int pwm;  // Pulse Width for Pan Servo boolean add;  // Whether to Increment or Decrement PW Value for Pan Servo int distance;  // Distance to Object Detected via Ultrasonic Ranger int oldDistance;  // Previous Distance Value Read from Ultrasonic Ranger float scale = 1.9866666666666666666666666666667;  // *Not Currently Used* int LeftPin = 6;  // Left Servo int RightPin = 9;  // Right Servo int PiezoPin = 11;  // Piezo int PingServoPin = 5;  // Pan Servo int irLPin = 0;            // Analog 0; Left IR int irCPin = 1;            // Analog 1; Center IR int irRPin = 2;            // Analog 2; Right IR int ultraSoundSignal = 7; // Ultrasound signal pin int val = 0;              // Used for Ultrasonic Ranger int ultrasoundValue = 0;  // Raw Distance Val int oldUltrasoundValue;  // *Not used* int pulseCount;        // Generic Counter int timecount = 0; // Echo counter int ledPin = 13; // LED connected to digital pin 13 #define BAUD 9600 #define CmConstant 1/29.034 void setup() {   Serial.begin(9600);   pinMode(PiezoPin, OUTPUT);   pinMode(ledPin, OUTPUT);   pinMode(LeftPin, OUTPUT);   pinMode(RightPin, OUTPUT);   pinMode(PingServoPin, OUTPUT);   pinMode(irLPin, INPUT);   pinMode(irCPin, INPUT);   pinMode(irRPin, INPUT);   for(i = 0; i < 500; i++) {     digitalWrite(PiezoPin, HIGH);     delayMicroseconds(1000);     digitalWrite(PiezoPin, LOW);     delayMicroseconds(1000);   }   for(i = 0; i < 20; i++) {   digitalWrite(PingServoPin, HIGH);   delayMicroseconds(655 * 2);   digitalWrite(PingServoPin, LOW);   delay(20);   }   ultrasoundValue = 600;   i = 0; } void loop() {   //Scan();   Look();   Go(); } void Look() {   irLval = analogRead(irLPin);   irCval = analogRead(irCPin);   irRval = analogRead(irRPin);   //if(counter > 10) {     //counter = 0;     //readPing();   //}   if(irLval > 200) {     PLval = 820;     PRval = 850;     x = 5;     cntr = cntr + 1;     clrpth = 0;     objdet = millis();   }   else if(irCval > 200) {     PLval = 820;     PRval = 850;     x = 10;     cntr = cntr + 1;     clrpth = 0;     objdet = millis();   }   else if(irRval > 200) {     PLval = 620;     PRval = 650;     x = 5;     cntr = cntr + 1;     clrpth = 0;     objdet = millis();   }   else {     x = 1;     PLval = 620;     PRval = 850;     counter = counter + 1;     clrpth = (millis() - objdet);     if(add == true) {       pwm = pwm + 50;     }     else if(add == false) {       pwm = pwm - 50;     }     if(pwm < 400) {       pwm = 400;       add = true;     }     if(pwm > 950) {       pwm = 950;       add = false;     }     digitalWrite(PingServoPin, HIGH);     delayMicroseconds(pwm * 2);     digitalWrite(PingServoPin, LOW);     delay(20);     readPing();     if(ultrasoundValue < 500) {       cntr = cntr + 1;       switch(pwm) {         case 400:           x = 7;           PLval = 650;           PRval = 650;           Go();           break;         case 500:           x = 10;           PLval = 650;           PRval = 650;           Go();           break;         case 600:           x = 14;           PLval = 850;           PRval = 850;           Go();           break;         case 700:           x = 10;           PLval = 850;           PRval = 850;           Go();           break;         case 950:           x = 7;           PLval = 850;           PRval = 850;           Go();           break;       }     }   }   //Serial.print("clrpth: ");   //Serial.println(clrpth);   //Serial.print("objdet: ");   //Serial.println(objdet);   //Serial.print("cntr: ");   //Serial.println(cntr);   if(cntr > 25 && clrpth < 2000) {     clrpth = 0;     cntr = 0;     Scan();   } } void Go() {   for(i = 0; i < x; i++) {     digitalWrite(LeftPin, HIGH);     delayMicroseconds(PLval * 2);     digitalWrite(LeftPin, LOW);     digitalWrite(RightPin, HIGH);     delayMicroseconds(PRval * 2);     digitalWrite(RightPin, LOW);     delay(20);   } } void readPing() {  // Get Distance from Ultrasonic Ranger timecount = 0; val = 0; pinMode(ultraSoundSignal, OUTPUT); // Switch signalpin to output /* Send low-high-low pulse to activate the trigger pulse of the sensor * ------------------------------------------------------------------- */ digitalWrite(ultraSoundSignal, LOW); // Send low pulse delayMicroseconds(2); // Wait for 2 microseconds digitalWrite(ultraSoundSignal, HIGH); // Send high pulse delayMicroseconds(5); // Wait for 5 microseconds digitalWrite(ultraSoundSignal, LOW); // Holdoff /* Listening for echo pulse * ------------------------------------------------------------------- */ pinMode(ultraSoundSignal, INPUT); // Switch signalpin to input val = digitalRead(ultraSoundSignal); // Append signal value to val while(val == LOW) { // Loop until pin reads a high value   val = digitalRead(ultraSoundSignal); } while(val == HIGH) { // Loop until pin reads a high value   val = digitalRead(ultraSoundSignal);   timecount = timecount +1;            // Count echo pulse time } /* Writing out values to the serial port * ------------------------------------------------------------------- */ ultrasoundValue = timecount; // Append echo pulse time to ultrasoundValue //serialWrite('A'); // Example identifier for the sensor //printInteger(ultrasoundValue); //serialWrite(10); //serialWrite(13); /* Lite up LED if any value is passed by the echo pulse * ------------------------------------------------------------------- */ if(timecount > 0){   digitalWrite(ledPin, HIGH); } } void Scan() {   // Scan for the Clearest Path   oldDistance = 30;   task = 0;   for(i = 1; i < 5; i++) {     switch(i) {       case 1:         //Serial.println("Pos. 1");         pwm = 1125;    ///  incr. by 100 from 1085         break;       case 2:         //Serial.println("Pos. 2");         pwm = 850; //// increased by 100 from 850         break;       case 3:         //Serial.println("Pos. 3");         pwm = 400;         break;       case 4:         //Serial.println("Pos. 4");         pwm = 235;         break;     }     for(pulseCount = 0; pulseCount < 20; pulseCount++) {  // Adjust Pan Servo and Read USR       digitalWrite(PingServoPin, HIGH);       delayMicroseconds(pwm * 2);       digitalWrite(PingServoPin, LOW);       readPing();       delay(20);     }     distance = ((float)ultrasoundValue * CmConstant);   // Calculate Distance in Cm     if(distance > oldDistance) {  // If the Newest distance is longer, replace previous reading with it       oldDistance = distance;       task = i;   // Set task equal to Pan Servo Position     }   }   //Serial.print("Task: ");   //Serial.println(task);   //Serial.print("distance: ");   //Serial.println(distance);   //Serial.print("oldDistance: ");   //Serial.println(oldDistance);   distance = 50;  // Prevents Scan from Looping   switch(task) {   // Determine which task should be carried out     case 0:  // Center was clearest       x = 28;       PLval = (850);       PRval = (850);       Go();       break;     case 1:  // 90 degrees Left was Clearest       x = 14;       PLval = (650);       PRval = (650);       Go();       break;     case 2:  // 45 degrees left       x = 7;       PLval = (650);       PRval = (650);       Go();       break;     case 3:  // 45 degrees right       x = 7;       PLval = (850);       PRval = (850);       Go();       break;     case 4:  // 90 degrees right       x = 14;       PLval = (850);       PRval = (850);       Go();       break;   } }    

Question by punkhead58 9 years ago  |  last reply 1 year ago