> For the complete documentation index, see [llms.txt](https://guides.mccaskeyrobotics.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guides.mccaskeyrobotics.org/fusion/ir-360-locator.md).

# IR 360 Locator

![Gather the parts above. The hardware is all 6-32. ](https://3423273789-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjRgHmD322MUgRPOyqMLh%2Fuploads%2F1C0ucXkKc58QmJQTpKbg%2F20220621_072041.jpg?alt=media\&token=9fb40361-2638-49af-9b7a-435d8125b98c)

![Attach standoffs from bottom](https://3423273789-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjRgHmD322MUgRPOyqMLh%2Fuploads%2FZo1VBgUGGm92cPu0vEIB%2F20220621_072119.jpg?alt=media\&token=7009af6d-abf1-4155-8dbd-92b8453562e8) ![Attach sensor to the top.](https://3423273789-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjRgHmD322MUgRPOyqMLh%2Fuploads%2FxK74ufDJN2yeBS0QM1sf%2F20220621_072216.jpg?alt=media\&token=29c4c1ce-5a5e-49fd-8011-683d6e84ca79) ![Plug sensor into the I2C ports... make sure the black wire is on the black side. ](https://3423273789-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjRgHmD322MUgRPOyqMLh%2Fuploads%2FYtmHdp4RoxYYuBGOsAAa%2F20220621_072313.jpg?alt=media\&token=8a519978-a343-4ffc-b235-970ca98d4734)

{% embed url="<https://docs.google.com/presentation/d/1PIDC5-qEMtaJw_AV_xwqjoFFHQoG97u4k29PQJQF7Zs/edit?usp=sharing>" %}

![IR Beacon](https://modernroboticsinc.com/wp-content/uploads/2019/03/0001365_360-ir-beacon.jpeg)

### Reading the values

```python
import Fusion

# Class definitions -----------------------------------------------------------
f = Fusion.driver()
l = Fusion.locator360(f)

# Program Start ---------------------------------------------------------------
while True:
    print ("Heading   = " + str(l.getHeading(1200)))
    print ("Intensity = " + str(l.getIntensity(1200)))
    print("") 
    f.delay(0.25)

```

### Navigating to the goal

<pre class="language-python"><code class="lang-python">import Fusion

# Object definitions -----------------------------------------------------------
f = Fusion.driver()
l = Fusion.locator360(f)

#while we are close to the beacon, straight away from it...
while (l.getIntensity(1200) > 50):
# the sensor will have a heading of 35 when it is 
## pointing 180 degrees away from the beacon
    if(l.getHeading(1200) &#x3C; 34):
        #turn counterclockwise
        f.motorSpeed(f.M0, 30)
        f.motorSpeed(f.M1, -30)
    elif(l.getHeading(1200) > 36):
        #turn clockwise
        f.motorSpeed(f.M0, -30)
        f.motorSpeed(f.M1, 30)
    else:
        #straight
        f.motorSpeed(f.M0, 50)
        f.motorSpeed(f.M1, 50)
        
<strong>#stop the robot now that we are far enough away        
</strong>f.motorSpeed(f.M0, 0)
f.motorSpeed(f.M1, 0)
#shoot the ball!
</code></pre>
