Convert Figma logo to code with AI

adafruit logoAdafruit_Learning_System_Guides

Programs and scripts to display "inline" in Adafruit Learning System guides

1,016
774
1,016
57

Top Related Projects

14,206

Arduino IDE 1.x

Arduino core for the ESP32

The official documentation for Raspberry Pi computers and microcontrollers

Your Gateway to Embedded Software Development Excellence :alien:

Visual Studio Code extension for Arduino

Quick Overview

The Adafruit_Learning_System_Guides repository is a comprehensive collection of code examples, tutorials, and project guides for various Adafruit hardware products. It serves as a valuable resource for makers, hobbyists, and educators working with Adafruit's electronic components and development boards.

Pros

  • Extensive collection of guides covering a wide range of Adafruit products
  • Well-documented code examples and tutorials for beginners and advanced users
  • Regularly updated with new content and improvements
  • Supports multiple programming languages, including CircuitPython and Arduino

Cons

  • Some guides may be outdated or not compatible with the latest hardware revisions
  • Navigation can be challenging due to the large number of guides and projects
  • Occasional inconsistencies in coding style and documentation format across different guides
  • Some advanced topics may lack in-depth explanations

Code Examples

  1. Blinking an LED using CircuitPython:
import board
import digitalio
import time

led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT

while True:
    led.value = True
    time.sleep(0.5)
    led.value = False
    time.sleep(0.5)
  1. Reading a temperature sensor with Arduino:
#include <Adafruit_Sensor.h>
#include <DHT.h>

#define DHTPIN 2
#define DHTTYPE DHT22

DHT dht(DHTPIN, DHTTYPE);

void setup() {
  Serial.begin(9600);
  dht.begin();
}

void loop() {
  float temperature = dht.readTemperature();
  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.println(" °C");
  delay(2000);
}
  1. Displaying text on an OLED screen using CircuitPython:
import board
import displayio
import adafruit_displayio_ssd1306
import terminalio
from adafruit_display_text import label

displayio.release_displays()
i2c = board.I2C()
display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)
display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=32)

splash = displayio.Group()
text = "Hello, World!"
text_area = label.Label(terminalio.FONT, text=text, color=0xFFFFFF, x=10, y=10)
splash.append(text_area)
display.show(splash)

Getting Started

To get started with Adafruit Learning System Guides:

  1. Clone the repository: git clone https://github.com/adafruit/Adafruit_Learning_System_Guides.git
  2. Navigate to the specific guide or project folder you're interested in.
  3. Follow the README or guide instructions for setup and dependencies.
  4. Upload the code to your Adafruit board using the appropriate method (e.g., CircuitPython or Arduino IDE).
  5. Modify and experiment with the code examples to suit your project needs.

Competitor Comparisons

14,206

Arduino IDE 1.x

Pros of Arduino

  • Larger community and more extensive documentation
  • Broader range of supported hardware and boards
  • More comprehensive IDE with advanced features

Cons of Arduino

  • Steeper learning curve for beginners
  • Less focus on specific project tutorials
  • More complex codebase, which can be overwhelming for new users

Code Comparison

Arduino:

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000);
  digitalWrite(LED_BUILTIN, LOW);
  delay(1000);
}

Adafruit Learning System Guides:

import board
import digitalio
import time

led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT

while True:
    led.value = True
    time.sleep(1)
    led.value = False
    time.sleep(1)

The Arduino code is in C++, while the Adafruit example uses CircuitPython. Arduino's syntax is more traditional and may be familiar to those with programming experience. Adafruit's approach is more beginner-friendly, using Python-like syntax and simpler abstractions.

Arduino core for the ESP32

Pros of arduino-esp32

  • Focused specifically on ESP32 development, providing comprehensive support for this popular microcontroller
  • Regularly updated with new features and bug fixes, ensuring compatibility with the latest ESP32 hardware
  • Extensive documentation and examples for various ESP32 functionalities

Cons of arduino-esp32

  • Steeper learning curve for beginners compared to Adafruit_Learning_System_Guides
  • Less diverse range of projects and tutorials, as it's centered around ESP32 development
  • May require additional libraries or tools for certain advanced features

Code Comparison

arduino-esp32:

#include <WiFi.h>

void setup() {
  WiFi.begin("SSID", "PASSWORD");
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
  }
}

Adafruit_Learning_System_Guides:

import board
import digitalio

led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
led.value = True

The arduino-esp32 example demonstrates Wi-Fi connectivity on ESP32, while the Adafruit_Learning_System_Guides example shows basic LED control using CircuitPython, highlighting the different focus areas of each repository.

The official documentation for Raspberry Pi computers and microcontrollers

Pros of documentation

  • More comprehensive and structured documentation covering a wide range of Raspberry Pi topics
  • Regular updates and contributions from the official Raspberry Pi team
  • Includes advanced topics like hardware design and low-level programming

Cons of documentation

  • Focuses solely on Raspberry Pi, limiting its scope compared to Adafruit's diverse range of products
  • May be overwhelming for beginners due to its extensive content

Code comparison

documentation:

from gpiozero import LED
from time import sleep

led = LED(17)

while True:
    led.on()
    sleep(1)
    led.off()
    sleep(1)

Adafruit_Learning_System_Guides:

import board
import digitalio
import time

led = digitalio.DigitalInOut(board.D13)
led.direction = digitalio.Direction.OUTPUT

while True:
    led.value = True
    time.sleep(0.5)
    led.value = False
    time.sleep(0.5)

Both examples demonstrate LED blinking, but documentation uses the gpiozero library specific to Raspberry Pi, while Adafruit_Learning_System_Guides uses CircuitPython, which is compatible with various microcontrollers.

Your Gateway to Embedded Software Development Excellence :alien:

Pros of platformio-core

  • Comprehensive build system and dependency management for multiple platforms
  • Extensive library ecosystem with automated library management
  • Supports a wide range of development boards and microcontrollers

Cons of platformio-core

  • Steeper learning curve for beginners compared to Adafruit guides
  • Less focus on educational content and tutorials
  • May be overkill for simple projects or hobbyist use

Code Comparison

Adafruit_Learning_System_Guides typically contains example code for specific projects:

import board
import neopixel

pixels = neopixel.NeoPixel(board.D6, 16)
pixels.fill((255, 0, 0))

platformio-core focuses on project configuration and build system:

[env:uno]
platform = atmelavr
board = uno
framework = arduino
lib_deps = 
    adafruit/Adafruit NeoPixel@^1.10.0

The Adafruit repository provides ready-to-use code examples for specific hardware and projects, while platformio-core offers a flexible development environment that can be customized for various platforms and libraries. Adafruit's approach is more beginner-friendly and educational, while platformio-core caters to more advanced users and complex project requirements.

Visual Studio Code extension for Arduino

Pros of vscode-arduino

  • Integrated development environment (IDE) for Arduino within VS Code
  • Supports multiple Arduino boards and libraries
  • Offers advanced code editing features like IntelliSense and debugging

Cons of vscode-arduino

  • Steeper learning curve for beginners compared to Adafruit guides
  • Requires separate installation of Arduino IDE and VS Code
  • May lack specific tutorials for Adafruit hardware

Code Comparison

Adafruit_Learning_System_Guides:

import board
import neopixel

pixels = neopixel.NeoPixel(board.NEOPIXEL, 10)
pixels.fill((255, 0, 0))

vscode-arduino:

#include <Arduino.h>

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000);
  digitalWrite(LED_BUILTIN, LOW);
  delay(1000);
}

The Adafruit_Learning_System_Guides repository focuses on CircuitPython examples for specific Adafruit hardware, while vscode-arduino provides a more general-purpose Arduino development environment within VS Code. The code examples reflect this difference, with Adafruit's example using CircuitPython for NeoPixels and vscode-arduino showing a standard Arduino LED blink sketch.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Introduction

This is a collection of smaller programs and scripts to display "inline" in Adafruit Learning System guides.

Adafruit is an Open Source company. To support Adafruit, please consider buying products at adafruit.com.

Starting in 2023, guides using a specific Adafruit board will be placed in a subdirectory with that product name to reduce the number of directories under the main directory. If you are creating a new guide, please check if your Adafruit board falls into one of these groups and make your project code directory in the appropriate subfolder.

  • Flora/
  • ItsyBitsy/
  • MagTag/
  • MEMENTO/
  • NeoTrellis/
  • PyLeap/
  • PyPortal/
  • QTPy/

If a new product or project group is contemplated, contact Learn moderators for guidance.

Issues

Issues with guides should be reported in the guide itself under "Feedback? Corrections?"

Make Your Own Guides

This repo is only for Adafruit approved Learning System Guides. If you'd like to write your own guide, see Create your own content with Adafruit Playground!.

Contributing and Testing

For details on contributing for Adafruit approved guides, see the guide Contribute to the Adafruit Learning System with Git and GitHub and Contribute to CircuitPython with Git and GitHub.

The code here is checked by GitHub Actions against Pylint (for CircuitPython code) or the Arduino compilation process.

Code in directories containing a file called .circuitpython.skip will be skipped by Pylint checks.

Code in directories containing a .[platformname].test file, such as .uno.test will be compiled against the corresponding platform.

Running pylint locally

Install a specific version of pylint under the name "pylint-learn":

pip install pipx
pipx install --suffix=-learn pylint==2.7.1

Then use the pylint_check script to run pylint on the files or directories of your choice (note that your terminal must be in the top directory of Adafruit_Learning_System_Guides, not a sub-directory):

./pylint_check CircuitPython_Cool_Project

Licensing

Adafruit Learning System code files should have author and license information conforming to the open SPDX specification. See this page for more.

Updated November 29, 2023