LED Flash Challenge – Semester 1, 2018/2019

We’re beginning RoboSumo with a short competitive puzzle called the LED Flash Challenge. No formal assessment weight is attached to this challenge, but we’ll keep a close eye on who does well. In this challenge, doing well means two things: getting it working quickly and, more importantly, trying to understand what you’re doing.

In today’s lab (and for some of you part of the next lab) you’ll be working with your team to complete two tasks:

  1. Build a simple breadboard circuit for the Arduino Nano and program it to blink an LED on and off.
  2. Add a second LED to the circuit and reprogram the Arduino to transmit a specific binary sequence as a series of flashes from the two LEDs.

The first task is very prescriptive, which means that we’ll basically tell you exactly what to do, but to complete the second task you’ll need to think for yourselves.

You need a team number to complete this challenge. Your tutor will assign your team a unique number within the range shown below:

  • Teams 10-19: DT066A Group C1 with Brian Cogan in KEG-012
  • Teams 20-29: DT066A Group C2 with Jane Courtney in KEG-014
  • Teams 30-49: DT066A Groups D1 and D2 with Ted Burke and Catherine Fitzgerald in KEG-036
  • Teams 50-59: DT066A Group E1 with Emma Robinson in KEG-004

Part 1: Blinking LED

This task is relatively straightforward and shouldn’t take you too long to get working. Open the link below in a new tab and follow the instructions as far as the end of Part 1. Once your LED is blinking, come back here. (Note: The LED you receive may be a different colour and/or shape to that shown in the instructions.)

Instructions for Blinking LED example

Once your LED is blinking, there are four things you need to understand before moving on:

  1. How one of the Arduino pins (D2) was turned into a digital output.
  2. How the LED is turned on.
  3. How the LED is turned off.
  4. How to delay the program for a specified number of milliseconds, so that the rate of the LED blinking can be controlled.

Once you understand these four things, you have finished this part of the task (the easy part) and it’s time to move on to the LED Flash Challenge.

Part 2: LED Flash Challenge

In this part, you’re going to modify your circuit to create a simple optical transmitter, which transmits a digital message (a sequence of 1s and 0s) as a series of LED flashes.

The message that you’ll transmit will be 2 bytes long (a byte is 8 bits, or 8 ones and zeros) and it will contain your team number (byte 1) followed by a second number calculated by subtracting your team number from 255 (byte 2).

For example, if your team number is 79…

  • byte1 = 79
  • byte2 = 255 – 79 = 176
  • byte1 + byte2 = 255

Here, let me explain how binary numbers work…

Try doing some independent research on binary numbers. There’s lots more great stuff on YouTube, Wikipedia, etc.

Specifically, you need to do the following:

  1. Modify the code to create a second digital output pin.
  2. Extend the circuit by adding a second LED (with current limiting resistor) to that digital output pin.
  3. Convert your team number into an 8-bit binary number. This is byte 1 of your message.
  4. Calculate the required value of byte 2 (so that byte1+byte2 = 255) and write it as an 8-bit binary number.
  5. Each byte will be transmitted as a sequence of ones and zeros, preceded by a start bit (1) and followed by a stop bit (0). That means your complete transmission will be 20 bits long. You should calculate this sequence ad write it down on paper first.
  6. To transmit a 1, turn LED1 off and LED2 on for 500ms.
  7. To transmit a 0, turn LED2 off and LED1 on for 500ms.
  8. To ensure the sequence is read correctly, transmit a long sequence of zeros (for about 5 seconds) before you transmit your message.
  9. As is typically the case in digital transmissions, each byte must be transmitted least significant bit first.

Let’s consider that example team number 79 again. As explained above, byte 1 is 79 and byte 2 is 146.

  • Before transmitting the sequence, send a “0” for about 5 seconds.
  • The first bit of the sequence is the start bit for byte 1 which is “1”.
  • Written as a binary number, 79 (seventy-nine) is 0b01001111. The “0b” prefix indicates that a number is being written in binary form – it’s not part of the number value. The byte is transmitted least significant bit first, i.e. in the following order: “1,1,1,1,0,0,1,0”.
  • The next bit is the stop bit for byte 1, which is “0”.
  • The next bit is the start bit for byte 2, which is “1”.
  • Written as a binary number, 216 is 0b10110000, so the next 8 bits are “0,0,0,0,1,1,0,1”.
  • The final bit is the stop bit for byte 2, which is “0”.

To summarise, the complete 20-bit sequence for team 79 would be as follows:

led_flash_challenge_example

The validator for checking your transmission is a web application which I have posted at the following location:

I will set a validation station in KEG-036 where you can record your result once your circuit is working. Other tutors may set up validation stations in the other rooms, but that will depend on available cameras and light levels.

You are welcome to try the validator on your own laptop / PC. In principle, it should work on any modern PC with a webcam and up-to-date browser. However, since video capture is relatively new in HTML, I recommend using the current release of Google Chrome which is what I tested it in. Some people have successfully used it in the web browser on their phone.

Your tutor will be able to clarify anything you don’t understand about this.

Advertisements
Posted in Uncategorized | Leave a comment

Electrical Engineering related videos

In case you’re interested in watching the full version of any of the videos I mentioned in this morning’s talk on Electrical Engineering, here they are:

The Waymo self-driving car:

Vijay Kumar’s TED talk, “Robots that fly … and cooperate”:

Boston Dynamics’ SpotMini robot (2 videos):

Also, here’s the thought-provoking “Every time Boston Dynamics has abused a robot” video:

Kevin Chubb’s €2 euro robot (scuttling is at 6:43)

Mathieu Le Goc’s Zooids:

Lukasz Bien’s self-balancing robot (Raspberry Pi):

Posted in Uncategorized | Leave a comment

RoboSumo Tournament semester 2 2017-2018 – 2pm Wed 25/4/2018

This semester’s RoboSumo tournament
takes place at 2pm,
Wednesday 25th April 2018
in room KEG-036, DIT Kevin St

Click here for Live Tournament ranking
(Note: All rankings are provisional and subject to change)

Please review the following information carefully from start to finish.

Tournament time and location

The tournament will commence at 2pm on Wednesday 25th April 2018 in room KEG-036, which is located in one of the smaller side corridors on the ground floor of the main building in DIT Kevin St. Weigh-in and robot validation will take place from 2-3pm. The first bouts will commence at 3pm. Owing to the smaller number of teams competing in this semester’s tournament (due to more DT066 groups being timetabled in semester 1), the initial “sorting” phase of the tournament will employ only one competition arena (sumo table).

The exact duration of the tournament will depend on how quickly things progress, but we aim to be completely finished by 5pm. To ensure that the tournament proceeds efficiently, teams must comply with the instructions of the referee(s) without dispute at all times.

Robot Weigh-in – 2:00pm in KEG-036

Before your robot can compete in any sumo bouts, it must weigh-in and be measured to ensure compliance with the competition rules.

  • The weight limit is 500 grams, as measured using the electronic scales in room KEG-036. This includes every part of the competing robot, including batteries.
  • The size limit is 10cm x 10cm when viewed from above (no part of the robot is allowed to be outside this boundary). The size limit will be strictly applied.

Teams should present their robots for the weigh-in at 2:00pm in room KEG-036. One of the tutors will act as compliance officer, managing the weigh-in. He/she will run through a checklist with each team. He/she will also provide Q6a feedback forms for you to complete and return with your robot after the tournament.

Sumo Bouts – 3:00pm in KEG-036

From 3:00pm onwards, teams should be continuously present in room KEG-036 and ready to compete immediately whenever summoned to one of the arenas. If a team is not ready when they are called to compete in a bout, their opponent will be granted a walkover in that bout. However, that team remains eligible to compete in subsequent bouts (until they are eliminated from the tournament).

Submitting Your Robot for Formal Assessment – KEG-036

Once your team is eliminated from the competition (or has won!), you must submit your robot for assessment. This is critically important for your final grade. The compliance officer (or another tutor) will be managing the submission of robots and will run through the following checklist with each team:

  1. Have you submitted your robot? A clear label showing the robot’s name should be securely attached. Suitable labels will be available in KEG-036.
  2. Optional: have you attached a 1-page feature guide to your robot? This sheet can be used to highlighting interesting design features that might not be immediately obvious to the assessment panel during the design assessment. There is no special format for this page – if you’re including one, just make it clear, fold it up, and attach it securely to your robot.
  3. Have you provided a completed robot information sheet? This sheet includes: team/robot name, team number, tutor name, name of every team member, blog address of every team member. Blank paper copies of the robot information sheet will be available in KEG-036.
  4. Have you returned a completed Q6a feedback form for each team member? Blank paper copies of the Q6a form will be provided at weigh-in.

Please do not leave without submitting your robot. Doing so may have a catastrophic effect on your grade.

DIT tournament rules

The RoboSumo tournament rules are those of the Robot Challenge “Mini” class, mostly as described in the Robot Challenge rules PDF document. However, those rules make provision for tournament organisers to introduce local rule changes as appropriate.

The following rule variations apply in the DIT RoboSumo tournament:

  1. No infrared starting devices are used. Instead, teams position and start their robots manually at the beginning of each bout, as instructed by the referee. Following manual starting, each robot should remain still for at least 2 seconds. (In most cases, this will simply require the inclusion of a 2-second delay in the robot’s Arduino program.) Robots which do not observe the 2 second delay at the start may still be allowed to compete at the discretion of the referee, but may be penalised by being placed in a disadvantageous starting position.
  2. The duration of each bout is limited to 60 seconds. At the discretion of the referee(s), the bout duration may be reduced further to speed the progress of the tournament. (Note: In the past, we have sometimes reduced the bout duration to 30 seconds to speed things up.)
  3. If both robots remain in the arena when the time limit for the bout expires, the referee will decide the winner based on each robot’s distance from the centre of the table (the closer the better), robot activity/behaviour during the bout, attitude/behaviour of each team during the bout, and/or other criteria at his/her own discretion. The referee may explain the criteria upon which the winner of a bout was chosen, but is not required to do so.
  4. When a bout fails to produce a clear winner, the referee may, at his/her own discretion, order the bout to be replayed.
  5. During most phases of the competition, matches will consist of a single bout. However, in the latter (knockout) stages of the competition the number of bouts in each match may be increased (e.g. best of 3 or best of 5), depending on the time available.
  6. The dimensions of each arena will be similar to those described in the Robot Challenge rules (77cm diameter with a 2.5cm white border), but may deviate slightly from them. However, the white border will not be less than 2.5cm in width.
  7. A robot which displays no responsiveness to its opponent or its surroundings for a significant period of time may, at the referee’s discretion, be disqualified from a bout. In particular, please note that robots which simply spin on the spot will be viewed very unfavourably by the referees unless they exhibit other behaviour which provides evidence that the spinning forms part of a meaningful control strategy.
  8. Each team’s robot spending limit is €70. This figure must include the cost of all components included in the final robot, as it is presented for the tournament validation process, with the following specific exceptions. The €70 budget does not include the cost of components or materials purchased but not used in the final robot. It does not include any cost incurred for postage and packing. Most recycled materials which are obtained free of charge do not need to be accounted for in the robot budget, but specialised components which would not be available to other teams through normal scavenging (e.g. remote control servos) may need to be represented by an indicative cost. In general, the referees do not systematically verify the cost of every robot, but where a specific dispute arises or it is suspected that a robot may be in breach of this rule, a team may be asked to provide evidence of their total spending (e.g. by providing receipts or showing where each component used can be purchased for the claimed price). Where a team is suspected to be in breach of this rule and cannot prove otherwise, the referees may apply a penalty of some kind or even disqualify a robot from the tournament.

Important note: Every effort has been made to compose the rules of each bout and the structure of the tournament as a whole in a way that is fair and consistent, but since it is impossible to anticipate every eventuality, the referee(s) must have ultimate discretion to overrule any regulation or introduce a rule change at any time.

Tournament structure

The tournament is divided into two main phases – a sorting phase and a knockout phase. Each team must also complete a validation process prior to competing in their first match.

Validation process

The validation process ensures that each robot complies with the restrictions on size and mass imposed by the Mini class rules. Teams who do not successfully complete the validation process are not eligible to compete in competitive bouts and can therefore only move down in the tournament ranking. Teams who are unable to field a compliant robot may still be asked to compete in one or more exhibition bouts for assessment purposes, but they cannot progress to the knockout phase of the tournament.

  • The mass of the robot, including batteries and all parts which will be attached to the robot during a bout, must not exceed 500 grams.
  • The footprint of the robot must not exceed 10cm by 10cm. Specifically, the entire robot and all parts attached to it, must fit within a cuboid (with vertical sides) of 10cm width and 10cm depth. Height is not specifically restricted. Note that robots are permitted to expand beyond their 10cm by 10cm footprint after the start of a bout, as described in the Robot Challenge rules.
  • All ground contact points that bear the weight of the main body of the robot must fit within the 10cm x 10cm footprint throughout the entire bout. It is permissible for parts of the robot to touch the ground outside the 10cm x 10cm footprint once the bout is underway, but the weight of the main body of the robot must not rest on them.

Following validation (the “weigh-in”), if a team makes any change to their robot which increases its size or mass, they must repeat the validation process prior to competing in a match.

Sorting phase

The initial ranking will be determined primarily by the results of the Race to the Wall challenge. The objective of the sorting phase is to select the top 8 teams. A variation on the so-called bubble sort will be used for the majority of the sorting phase. However, the referee(s) may deviate from this pattern at his/her/their own discretion to resolve any unforeseen ranking issues or anomalies.

In each group, the sorting phase will continue until the referee is satisfied that he/she has identified which 8 teams should progress to the knockout phase of the tournament.

Knockout phase

The 8 top-ranked teams will proceed to the knockout phase of the tournament. When a team loses a match in this phase, they are eliminated from the tournament. The referees will decide the number of bouts per match in each stage of the knockout phase (ordinarily best of 3 bouts, apart from the final which is best of 5 bouts).

Laboratory access during the tournament

  • There will be no RoboSumo lecture from 2-3pm on the day of the tournament. Instead, teams will proceed directly to KEG-036 at 2pm for the tournament weigh-in.
  • Access to laboratories other than KEG-036 before 3pm on the day of the tournament will be subject to the limitations of the timetable for each laboratory (other classes may be timetabled in some rooms before 3pm).
  • Room KEG-036 will be open from 2pm onwards. However, space may be limited due to re-organisation of tables for the tournament.
  • The normal lab facilities will be available from 3pm onwards, to facilitate teams who wish to carry out repairs or adjustments to their robots. However, bear in mind that if the referee summons you to a match and you are not present, your opponent will be granted a walkover victory.

Competitor check list

Inevitably, many teams will face technical issues on the day of the tournament, and it’s impossible to foresee every problem. However, there are certain issues which we see every year:

  1. PLEASE PLEASE PLEASE ensure that your robot is compliant with the size and weight limits. Yes, 101mm is too much! And yes, 501 grams is too much! To avoid unexpected problems, please leave some margin for error. We need to be absolutely strict about these limits and butchering your carefully crafted robot at the last minute to reduce its size or weight can be a heartbreaking experience.
  2. If you haven’t already tested your robot actually driving around, please do so BEFORE the tournament. Bizarrely, every year we see teams who leave it until the very last minute to attach the wheels to their motors for the first time. Unfortunately, many of them discover at that point that their gearing is totally inappropriate and the robot cannot actually move.
  3. Focus on the basics. This means moving around and responding to the white border of the arena so that you don’t accidentally drive out of it. Even if you don’t have a working rangefinder you can still expect to win some bouts just by staying mobile and staying on the table.
  4. Speaking of which… don’t be too reliant on your rangefinder / proximity sensor (if you’re using one). These sensors can sometimes completely fail to detect an opponent, depending on its shape and material. Design your code so that the robot will still do something intelligent if it doesn’t detect the opponent.
  5. Make sure your robot doesn’t simply spin around the spot for the entire bout. This behaviour will be viewed very unfavourably by the referee.
  6. Make sure you bring plenty of spare batteries.

Finally, remember to get plenty of photos and videos of your robot (and team) in the run up to and during the tournament. Of all the evidence you will provide on your blog, photos and videos are some of the easiest to create, and they can really help to tell the story of your project.

Finally, best of luck to all of you!

Posted in Uncategorized | Leave a comment

Code examples from final RoboSumo lecture

Simple rangefinder example:

//
// RoboSumo navigation example using rangefinder
// Written by Ted Burke - 17-4-2018
//

void setup()
{
  pinMode(2, INPUT);  // rangefinder echo
  pinMode(3, OUTPUT); // rangefinder trigger
  pinMode(4, OUTPUT); // left motor forward
  pinMode(5, OUTPUT); // left motor reverse
  pinMode(6, OUTPUT); // right motor forward
  pinMode(7, OUTPUT); // right motor reverse
  pinMode(8, OUTPUT); // blue LED
  // A0 is left colour sensor
  // A2 is right colour sensor

  // Serial.begin(9600);
}

void loop()
{
  int colour_left, colour_right, object_detect;
  
  // Read colour sensors
  colour_left = analogRead(0);  
  colour_right = analogRead(2);

  // Use rangefinder to check for object
  digitalWrite(3, HIGH);
  delayMicroseconds(20);
  digitalWrite(3, LOW);
  while(digitalRead(2) == 0); // wait for start of echo
  delayMicroseconds(2000);
  if (digitalRead(2) == 0) object_detect = 1;
  else object_detect = 0;

  // Robot behaviour
  if (object_detect == 0)
  {
    digitalWrite(8, HIGH); // LED on
    motors(1, -1);
  }
  else
  {
    digitalWrite(8, LOW); // LED off
    motors(1, 1);
  }

  delay(100);
}

void motors(int left, int right)
{
  if (left > 0)
  {
    digitalWrite(4, HIGH);
    digitalWrite(5, LOW);
  }
  else if (left < 0)
  {
    digitalWrite(4, LOW);
    digitalWrite(5, HIGH);
  }
  else
  {
    digitalWrite(4, LOW);
    digitalWrite(5, LOW);
  }
  
  if (right > 0)
  {
    digitalWrite(6, HIGH);
    digitalWrite(7, LOW);
  }
  else if (right < 0)
  {
    digitalWrite(6, LOW);
    digitalWrite(7, HIGH);
  }
  else
  {
    digitalWrite(6, LOW);
    digitalWrite(7, LOW);
  }
}

Final state machine example:

//
// RoboSumo navigation example using state machine
// Written by Ted Burke - 17-4-2018
//

int state = 1;

void setup()
{
  pinMode(2, INPUT);  // rangefinder echo
  pinMode(3, OUTPUT); // rangefinder trigger
  pinMode(4, OUTPUT); // left motor forward
  pinMode(5, OUTPUT); // left motor reverse
  pinMode(6, OUTPUT); // right motor forward
  pinMode(7, OUTPUT); // right motor reverse
  pinMode(8, OUTPUT); // blue LED
  // A0 is left colour sensor
  // A2 is right colour sensor

  // Serial.begin(9600);
}

void loop()
{
  int colour_left, colour_right, object_detect;
  
  // Read colour sensors
  colour_left = analogRead(0);  
  colour_right = analogRead(2);

  // Use rangefinder to check for object
  digitalWrite(3, HIGH);
  delayMicroseconds(20);
  digitalWrite(3, LOW);
  while(digitalRead(2) == 0); // wait for start of echo
  delayMicroseconds(2000);
  if (digitalRead(2) == 0) object_detect = 1;
  else object_detect = 0;

  // Robot behaviour - state machine
  if (state == 1)
  {
    // Spin and search
    motors(0, 1);
    digitalWrite(8, LOW);

    if (object_detect == 1) state = 2;
  }
  else if (state == 2)
  {
    // charge at opponent
    motors(1, 1);
    digitalWrite(8, HIGH);

    if (object_detect == 0) state = 1;
    if (colour_left > 512) state = 3;
    if (colour_right > 512) state = 4;
  }
  else if (state == 3)
  {
    // white detected on left
    motors(0, 1);

    if (colour_right > 512) state = 5;
  }
  else if (state == 4)
  {
    // white detected on right
    motors(1, 0);

    if (colour_left > 512) state = 5;
  }
  else if (state == 5)
  {
    // reverse to centre of table
    motors(-1, -1);
    delay(2500);
    state = 1;
  }

  delay(100);
}

void motors(int left, int right)
{
  if (left > 0)
  {
    digitalWrite(4, HIGH);
    digitalWrite(5, LOW);
  }
  else if (left < 0)
  {
    digitalWrite(4, LOW);
    digitalWrite(5, HIGH);
  }
  else
  {
    digitalWrite(4, LOW);
    digitalWrite(5, LOW);
  }
  
  if (right > 0)
  {
    digitalWrite(6, HIGH);
    digitalWrite(7, LOW);
  }
  else if (right < 0)
  {
    digitalWrite(6, LOW);
    digitalWrite(7, HIGH);
  }
  else
  {
    digitalWrite(6, LOW);
    digitalWrite(7, LOW);
  }
}
Posted in Uncategorized | 3 Comments

Example code for rangefinder testing

//
// HC-SR04 rangefinder testing - written by Ted Burke 11-4-2018
//

int echo_pin      = 2;
int trigger_pin   = 3;
int green_LED_pin = 4;
int red_LED_pin   = 5;

void setup()
{
  // Set i/o pins
  pinMode(echo_pin, INPUT);
  pinMode(trigger_pin, OUTPUT);
  pinMode(green_LED_pin, OUTPUT);
  pinMode(red_LED_pin, OUTPUT);
}

void loop()
{
  // Send trigger pulse
  digitalWrite(trigger_pin, HIGH);
  delayMicroseconds(20);
  digitalWrite(trigger_pin, LOW);

  // Wait for 4ms (68cm return trip at speed of sound)
  delayMicroseconds(4000);

  // Check if echo pulse is still active
  if (digitalRead(echo_pin) == 1)
  {
    // Echo pulse still active: no object within distance
    digitalWrite(green_LED_pin, LOW);
    digitalWrite(red_LED_pin, HIGH);
  }
  else
  {
    // Echo pulse has ended: an object is within distance
    digitalWrite(green_LED_pin, HIGH);
    digitalWrite(red_LED_pin, LOW);
  }

  // Wait 100 ms before triggering sensor again
  delay(100);
}
Posted in Uncategorized | Leave a comment

John’s Arduino pinout template

This is the link to download the template:

John’s RoboSumo Arduino pinout template

Posted in Uncategorized | Leave a comment

Distance sensing with feedback

In order to detect your opponent, some form of distance sensor is required. One of the options available to you is the Ultrasonic sensor (HC-SR04). This sends out a signal (Trigger) and then listens for the reflected (Echo) signal. The time it takes for the signal to be reflected can be converted to the distance of the object using the speed of sound.

In last week’s session with my group I demonstrated haptic feedback using a virbation motor to alert the user when an object is within a certain distance (I used the standard PING code available in the Arduino IDE). This code can be adjusted to use an LED in place of the motor.

In my example the Trig pin is connected to D2, Sig pin to D3 and the motor (or LED with appropriate resistor) to pin D10.


const int pingPin = 2, sigPin = 3, warningPin =10;

 

void setup() {
// initialize serial communication:
Serial.begin(9600);
pinMode(pingPin, OUTPUT);
pinMode(sigPin, INPUT);
pinMode(warningPin, OUTPUT);
}

void loop() {
// establish variables for duration of the ping,
// and the distance result in inches and centimeters:
long duration, inches, cm, voltage;

// 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(pingPin, OUTPUT);
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(5);
digitalWrite(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(pingPin, INPUT);
duration = pulseIn(sigPin, HIGH);

// convert the time into a distance
inches = microsecondsToInches(duration);
cm = microsecondsToCentimeters(duration);

 

Serial.print(inches);
Serial.print("in, ");
Serial.print(cm);
Serial.print("cm");
Serial.println();

if(cm<10){

digitalWrite(warningPin, HIGH);

}
else{

digitalWrite(warningPin, LOW);
}

delay(100);
}

long microsecondsToInches(long microseconds) {
// According to Parallax's datasheet for the PING))), there are
// 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
// second). This gives the distance travelled by the ping, outbound
// and return, so we divide by 2 to get the distance of the obstacle.
// See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds) {
// 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;
}

 

Posted in Uncategorized | 1 Comment