Download Downloading - All IT eBooks
Transcript
Getting Started – Setting Up Your Raspberry Pi and Arduino When you launch the program, you will be presented with a sketch. This is where you will write your Arduino code: 1. You will find a number of options in the top menu. These include the examples that come bundled with the Arduino IDE, which can be found by navigating to File | Examples. 2. Try selecting this option 0.1 Basics | BareMinimum. 3. To upload an example to your microcontroller, ensure that it is plugged in. Next you will need to set the board. You can do this by navigating to Tools | Board. Here, you will find a list of the Arduino microcontrollers, and then you can select the model you have purchased, for example, Arduino Uno. 4. Next, we need to select the USB port that the board is plugged into so that the IDE knows where to upload the sketch code. If your Arduino IDE does not detect the USB port, you may need to run the application as root via sudo. StackExchange provides some suggestions on fixing this issue, at http://arduino. stackexchange.com/questions/739/arduino-programonly-works-when-run-as-root. The USB port list can be found by navigating to Tools | Serial Port. Once you have the serial port correctly configured, you can upload the code to the microcontroller. 5. Click on the play button icon in the sketch. If everything was configured successfully, your code should now be running on the Arduino. The sketch we uploaded does not do anything. However, it is a good way of verifying that our setup is correct. In Chapter 3, Central Air and Heating Thermostat, we will dive into Arduino in more detail. Next, let's quickly look at the Arduino to Raspberry Pi connection bridge shield. Using the Arduino to Raspberry Pi connection bridge The Arduino to Raspberry Pi connection bridge hardware provides a convenient method to connect our Raspberry Pi to some of the Arduino shields that are available. Thus, we can reuse hardware between our two devices. [ 24 ]