Open a Command-Line Session with Raspberry Pi Hardware

This topic shows you how to configure and open a command-line session with the target hardware.

To open a connection to your board:

  • If you configured your Raspberry Pi™ to automatically obtain an IP address using DHCP, communicate with your board using the host name you assigned to the board during the firmware update process.

    For example, if the board is named raspberrypi-ah, enter the following in a MATLAB® Command Window:

    h = raspberrypi('raspberrypi-ah')
    h.openShell('ssh')

  • If you configured your Raspberry Pi to use a static IP address during the firmware update process, use that IP address to communicate with your board.

    For example, if the board's IP address is 192.168.1.2, enter the following in a MATLAB Command Window:

    h = raspberrypi('192.168.1.2')
    h.openShell('ssh')

  1. Connect an Ethernet cable from your host computer to the board.

  2. Communicate with the board:

    • If you configured your Raspberry Pi to automatically obtain an IP address using DHCP, communicate with your board using the host name you assigned to the board during the firmware update process.

      For example, if the board is named raspberrypi-ah, enter the following in a MATLAB Command Window:

      h = raspberrypi('raspberrypi-ah')
      h.openShell('ssh')

    • If you configured your Raspberry Pi to use a static IP address during the firmware update process, use that IP address to communicate with your board.

      For example, if the board's IP address is 192.168.1.2, enter the following in a MATLAB Command Window:

      h = raspberrypi('192.168.1.2')
      h.openShell('ssh')

  3. When a PuTTY terminal window opens, press the Enter key on your keyboard. The terminal window displays the Linux® command line.

  4. At the Linux command line, log in by entering the user name and password. For example:

    raspberrypi-boardname login: pi
    Password: raspberry
    
  5. When you are finished, enter logout on the Linux command line, and close PuTTY to end the serial connection.

Was this topic helpful?