Скачать книгу

alt="Snapshot of the Bluetooth and Wi-Fi buttons, beside the volume control and clock."/>

      FIGURE 3-3: The Bluetooth and Wi-Fi buttons, beside the volume control and clock.

      Click a network to select it and you’re prompted to enter the Pre-shared Key, which is the Wi-Fi password. If the connection fails or drops, the Wi-Fi icon changes to an icon with two red crosses on it.

      You can test whether your connection is working by opening the web browser and visiting a web page with it (see Chapter 4).

      After you’ve set up a Wi-Fi network using the tool, your Raspberry Pi remembers it, so it automatically reconnects whenever you restart your Raspberry Pi or reconnect after previously turning off Wi-Fi. You can also use the network connection you have set up from the command line.

      

When you connect to a new network, the Pi doesn’t remember the previous network’s password, so you need to reenter it if you want to reconnect to it later.

      The Raspberry Pi 4, 400, 3, and Pi Zero W are Bluetooth-enabled, so you can use a wireless Bluetooth keyboard and/or mouse with your Pi.

      

Not all wireless devices are Bluetooth-enabled: Keyboards and mice that come with their own USB dongles typically don’t use Bluetooth.

      The process of getting two Bluetooth devices to work together is called pairing them. Check the instructions for your device to see how you make it discoverable so that your Raspberry Pi can pair with it. This isn’t always obvious: On Sean’s mouse, the process involved pushing and holding a button and then pushing the two mouse buttons together and holding them until the mouse started flashing.

      Once you have made your device discoverable, click the Bluetooth menu at the top of the screen (refer to Figure 3-3) and choose Add Device. Your Raspberry Pi will search for devices. When it finds your device, click it and then click the Pair button. When setting up a keyboard, we had to enter a code shown on the screen on the new keyboard. With the mouse, we were asked to confirm that a code was showing on the mouse (which it couldn’t be, because the mouse has no display), but we confirmed that it was, to complete the setup.

      

It’s easiest to connect your camera before you plug your Raspberry Pi into any cables.

      The Raspberry Pi 400 does not have a camera connector.

Photo depicts the Raspberry Pi High Quality Camera (left) and Camera Module (right). The Camera Module has a lens built in, but there is no lens fixed to this High Quality Camera yet.

      FIGURE 3-4: The Raspberry Pi High Quality Camera (left) and Camera Module (right). The Camera Module has a lens built in, but there is no lens fixed to this High Quality Camera yet.

      Connecting the camera on a Pi Zero

      The Pi Zero camera socket uses a different width of cable to the main Raspberry Pi boards. You can buy the cable separately or get it with the official Pi Zero case.

      The camera and the Pi board have similar sockets for the cable. You press the connector between your thumb and finger and gently pull to open the connector. The parts don’t separate, but there’s enough of a gap to remove and insert the cable. On the Raspberry Pi, the camera connector is on the right of the board.

Photo depicts connecting the Raspberry Pi Camera Module to a Raspberry Pi Zero.

      Connecting the camera on other Raspberry Pi models

      The camera connector socket on the other Raspberry Pi models is about 1 inch long, and it touches the bottom edge of the board.

      To open the camera connector on your Raspberry Pi board, hold the ends between your finger and thumb and gently lift. The plastic parts don’t separate, but they move apart to make a gap. This is where you insert the camera’s cable.

      At the end of the camera’s cable are silver connectors on one side. Hold the cable so that this side faces to the left, away from the side with the USB socket(s). Insert the cable into the connector on the board and press it gently home, and then press the socket back together again.

Photo depicts connecting the Raspberry Pi Camera Module to a Raspberry Pi 4.

      Testing the Camera Module

      Let’s test whether your camera is working correctly.

      

Make sure the camera is enabled: Go into the Raspberry Pi Configuration tool, click Interfaces, and select Enabled beside the Camera option. For more information, see the “Configuring Your Raspberry Pi in Raspberry Pi OS” section, earlier in this chapter. You’ll need to reboot after enabling the camera.

      We’ll test the camera from the command line interface, which is covered in more depth in Chapter 5. Click the Terminal icon at the top of the screen to start. It has a >_ symbol on it. To take a still photo, type in this command:

       raspistill -o testshot.jpg

      You should see what the camera sees onscreen for a moment before it takes the photo. The picture is saved with the filename testshot.jpg. You can verify that the image was created by looking at the files

Скачать книгу