banner



How To Install Adafruit Library

18 Install and Configure the Arduino IDE

Arduino compatible micro-controllers can all be programmed through theArduino Integrated Development Environment (IDE) available from arduino.cc. Install a current version for your computer and operating system, then use this checklist to add capabilities to your basic install. For Windows, the preferred installation method is the "Windows app Win 8.1 or 10" available through the Microsoft App Store link on arduino.cc. For M1 and other Apple Silicon Macs you will have to allow Mac OS to install Rosetta.

2021-10-26: The latest version is 1.8.16 and just about any recent version will be fine starting out, although the version 2.0 beta offers a lot of features if you can tolerate rough edges. (If your previous installation was configured to use MATLAB with an Arduino UNO see the cleanup instructions further below.) Once your installation succeeds, and you start the application, you should see a window something like the one on the left, below:

Install Support for Additional Boards

You will need to follow these steps to support your M0 based microcontroller kit. Choose Arduino/Preferences and paste this line into the Additional Boards Manager URLs as shown about 3/4 of the way down, then hit OK.

https://adafruit.github.io/arduino-board-index/package_adafruit_index.json

Arduino Preferences Window
Set your sketchbook folder location, make the font size big enough to read easily, and add locations to the Additional Boards Manager URLs. Be sure to click "Display line numbers" so it will be easier to talk about which line needs to be changed when we are discussing your code.

Choose Tools/Board/Boards Manager and type "SAMD" in the search field. Mouse over the "Arduino SAMD Boards" segment and hit install. Wait for the install to complete (which could take multiple minutes), then scroll down to "Adafruit SAMD Boards" and hit install. Wait until it completes and hit Close. This installs the support for more advanced boards like the Adafruit Itsy Bitsy M0 Express used in MECH 217 starting in Fall 2020.

Choose Tools/Board/ Adafruit ItsyBitsy M0 or Tools/Board/ Arduino Genuino/UNO from the menu bar to match the board you are using, plug your board into a USB port, then choose Tools/Port to select the right USB port for communication with the board.

Click on the magnifying glass in the top right to open the serial monitor and arrange the windows side by side as above so you can see the code and the output it generates at the same time.

Run Your First Sketch

Cut and paste the code below into the window (replacing what's already there) then compile and upload it to the microcontroller board by hitting the arrow button, second from the top left.

void setup() {   Serial.begin(115200);   pinMode(13, OUTPUT);   Serial.println("Hello World!");   delay(1000); }  void loop() {   digitalWrite(13, 1);   Serial.print("Hello Again! ");   Serial.print("time is now ");   Serial.print(millis());   Serial.print(" ms from boot.\n");   delay(500);   digitalWrite(13, 0);   delay(500); }

If all goes well you should see output on the monitor window and the LED on the UNO blinking on and off. If you get weird characters, or nothing at all in the serial monitor window, make sure the speed setting in the lower left matches the speed set in the Serial.begin( ) function call. If you don't see the first "Hello World!" you may need to add a delay before it prints so there is enough time for the USB negotiation to complete.

You now have a functioning Arduino IDE installation. Try editing the code to print different text and upload the new version by pressing the arrow again. (This code took about 14 seconds to compile and load on a slow 2019 Windows machine,  8 seconds on a slow 2014 Macbook Air, 7 seconds on an M1 Mac under Rosetta, and 6 seconds on a faster Quad-Core 2017 iMac, all of which are long enough to make it worth thinking about your changes before just hitting the button.)

Unplug the USB cable from your computer and attach it to a phone charger or similar power source. The LED should still blink the same way, under control of your sketch with the code executing on the board, independently of your computer.

Clean up After any Old Installations (MATLAB)

Get rid of the old preferences.txt fileif you have previously installed some Arduino extensions that aren't compatible with your current processor. In the 2020 offering of MECH 217 we ran into this problem with MatLab extensions installed on some students' computers to support first year courses. If you see the word MatLab in any of the error messages you get, follow this video (3:31) to walk you through getting a fresh installation. Find the old preferences file (bottom right of the preferences window) and rename or delete it while Arduino is closedto avoid a rewrite of the file later.

Important Controls to Remember on the IDE

Font Size: Use Ctrl+ and Ctrl- (Cmd+ and Cmd- on Mac) to change the editor font size so everybody on your team can read it. This is especially important for instructors and TAs looking over your shoulder or remote viewing.

Load: Use the arrow icon on the top left to compile and load your sketch to you microcontroller.

Serial Monitor: Use the magnifying glass icon on the top left to open the serial monitor display.

Serial Plotter: Choose Tools/Serial plotter from the menu to graph the numbers on the monitor in real time.

Select, Cut, Paste: Ctrl-A, Ctrl-C, Ctrl-V (Cmd on Mac) are standard key shortcuts that will be really useful for grabbing data from the serial monitor.

Some hardware or special capabilities will require you to install additional support libraries. From the IDE choose Tools/Manage Libraries to install from the general collection of 3rd party libraries. This example for the BMP180 pressure sensor walks you through the process in detail. (video 5:49).

Choose Tools/Manage Libraries… and type RTClib in the search field. Mouse over the "RTClib by Adafruit" segment and hit install. Wait for the install to complete (which could take minutes), then hit Close. Including this library enables floating point output in printf() for the M0, which will make your life much easier. At the same time, you may want to install the Adafruit libraries for the BMP085, BMP280, BME280, and LIS3DH. You will also need the Adafruit Unified Sensor library to support some of these.  Use the library manager to install a library called "Time by Paul Stoffregen" (required by RWS_UNO) if it has not been installed automatically.

Some libraries depend on the installation of other libraries to function. For example, you need to be sure to install the Adafruit Unified Sensor library to support many of their sensors. Adafruit BMP085 Unified knows all about the BMP180 and Adafruit Unified Sensor provides the basics for all the other "Unified" libraries.

Installing Libraries Manually

For less common libraries that are not part of the general collection, you will have to make the installation yourself. For example, to install my RWS_UNO library files, you will need to:

  1. Locate your Arduino libraries folder on your computer (probably called ~/Documents/Arduino/libraries or something similar).
  2. Download https://github.com/sellensr/RWS_UNO and unzip the file.
  3. Copy the RWS_UNO folder into the Arduino libraries folder. (Be sure there isn't a double folder level e.g. /Documents/Arduino/libraries/RWS_UNO-master/RWS_UNO-master/… produced by windows unzip extract all.)
  4. Restart the Arduino IDE so that it will recognize the new library.

My Own Personal Checklist and Additional Board Support

You probably don't need all of this, but here's what I do to create a new install on MacOS:

  • delete Arduino15 from /Users/you/Library or Users/you/AppData/Local to get a clean start
  • install latest MacOS Teensyduino version for IDE version 1.8.10 or higher and go to preferences
    • set sketch folder to point to Documents/Arduino
    • turn off check for updates
    • turn on line numbers
    • set interface scale large enough to make icons readable from 1 metre away
    • set editor font size to make the code readable from 1 metre away
    • add https://adafruit.github.io/arduino-board-index/package_adafruit_index.json (as above) to additional boards manager, plus http://arduino.esp8266.com/stable/package_esp8266com_index.json and https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json with comma-space between.
  • Then use boards manager to install the latest Arduino SAMD, Adafruit AVR, Adafruit SAMD, esp8266, esp32, then restart the IDE.
  • Be sure RTClib by Adafruit is installed to provide printf support for %f.
  • For Teensy 3.X, etc. support download and install latest edition of Teensyduino, https://www.pjrc.com/teensy/td_download.html which may be lagging behind the latest IDE version. The newer MacOS versions are a complete and separate Arduino installation, while earlier versions patched your existing application. Go to Teensyduino/Contents/Java/hardware/teensy/avr/cores/teensy3/serial1.c, etc. and raise the size of the RX and TX buffers to 256 to avoid dropping characters.

https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification provides a lot of information on how other boards get installed.

How To Install Adafruit Library

Source: https://ecampusontario.pressbooks.pub/rwsnotes/chapter/install-and-configure-the-arduino-ide/

Posted by: wolfestrue1935.blogspot.com

0 Response to "How To Install Adafruit Library"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel