> ## Documentation Index
> Fetch the complete documentation index at: https://docs.samstudio.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Pair Physical Blocks with SAM Script via Bluetooth

> Connect your physical SAM Labs Bluetooth blocks to SAM Script using a Pairing ID. Learn how to set up, troubleshoot, and manage block connections.

Before your code can control a physical SAM Labs block, you need to pair it with SAM Studio over Bluetooth. Pairing links a specific block to your session using a unique **Pairing ID**, so your script knows exactly which hardware to talk to.

## Prerequisites

<CardGroup cols={3}>
  <Card title="Charged Block" icon="battery-full">
    Make sure your SAM Labs block is fully charged before pairing.
  </Card>

  <Card title="Bluetooth Enabled" icon="bluetooth">
    Bluetooth must be turned on in your device's system settings.
  </Card>

  <Card title="Supported Browser" icon="globe">
    Chrome is recommended. Some browsers do not support Web Bluetooth.
  </Card>
</CardGroup>

## How to Pair a Block

<Steps>
  <Step title="Power on your block">
    Press the button on your SAM Labs block to turn it on. The LED will light up to show it is ready.
  </Step>

  <Step title="Open the Connect dialog">
    In SAM Script, click the **Pair** or **Connect** button in the toolbar at the top of the editor.
  </Step>

  <Step title="Choose your Pairing ID">
    A dialog appears showing the Pairing IDs available to you. Select the Pairing ID that matches the block you want to connect.
  </Step>

  <Step title="Confirm the connection">
    Click **Connect**. The block's LED will flash to confirm that pairing was successful.
  </Step>

  <Step title="Start coding">
    The block now appears as available in your script. You can reference it in your code straight away.
  </Step>
</Steps>

## Setting Up Pairing IDs

Teachers assign Pairing IDs to students or groups through the **Teacher Dashboard**. Each Pairing ID maps to one or more physical blocks, so students only see the blocks that belong to their session. If you are a teacher setting up a class, assign a Pairing ID to each student or team before the lesson begins — students will then see their assigned ID in the Connect dialog when they log in.

<Note>
  **ChromeOS users:** some Chromebook models require the SAM Labs Bluetooth helper extension to establish a reliable connection. If your block does not appear in the Connect dialog on ChromeOS, visit the [Troubleshooting](/platform/troubleshooting) page for installation steps.
</Note>

## Troubleshooting Connection Problems

<AccordionGroup>
  <Accordion title="The block does not appear in the Connect dialog">
    * Confirm the block is powered on — press its button and check for an LED light.
    * Make sure Bluetooth is enabled in your operating system settings, not just in the browser.
    * Move the block closer to your device. SAM Labs blocks work best within about 10 metres.
    * Refresh the SAM Script page and try opening the Connect dialog again.
  </Accordion>

  <Accordion title="The block appears but fails to connect">
    * Check that no other device or browser tab is already connected to the same block — a block can only pair with one session at a time.
    * Try turning the block off, waiting five seconds, and turning it back on before re-pairing.
    * If you are on ChromeOS, make sure the Bluetooth helper extension is installed and enabled.
  </Accordion>

  <Accordion title="The block disconnects during a session">
    * Low battery is the most common cause. Charge the block and reconnect.
    * Reduce the distance between the block and your device.
    * Click **Connect** again in the toolbar — SAM Script will attempt to re-establish the pairing without reloading your code.
  </Accordion>
</AccordionGroup>
