Code Monkey home page Code Monkey logo

arduinoboardmanager's Introduction

ArduinoBoardManager

Arduino library to determine the Arduino models and features, as well as the SDK version.

Most features can be accessed via static variables.

You must instantiate if you want to know if the name of the board or if specific features such exist, for example multiple serial connections on the Arduino Mega.

This list may be neither comprehensive nor up to date

A full List of boards and processor names are available on Wikipedia:

For more information, please see my blog article titled Determine Arduino Board Model and Version Programmatically

Installation

After downloading, rename folder to 'ArduinoManager' and install in Arduino Libraries folder. Restart Arduino IDE, then open File->Sketchbook->Library->ArduinoManager->featuresniffer sketch.

Usage

#include <ArduinoBoardManager.h>


ArduinoBoardManager arduino = ArduinoBoardManager();

void setup() {
  unsigned long M = 1000000;
  unsigned int k = 1000;
  Serial.begin(9600);

  while(!Serial); // on Leonardo/Micro, wait for serial
  
  // The Arduino board name
  Serial.print("Board is compatible with Arduino ");
  Serial.println(arduino.BOARD_NAME);
  Serial.println();
  
  // the Arduino SDK version
  Serial.print("SDK Version is: ");
  Serial.println(ArduinoBoardManager::SDK_VERSION);
  Serial.println();
  
  // The processor features (RAM, speed, etc)
  Serial.print("This "); Serial.print(arduino.BOARD_NAME);
  Serial.print(" is an "); Serial.print(ArduinoBoardManager::NUM_BITS);
  Serial.print("-bit, "); Serial.print(ArduinoBoardManager::MAX_MHZ/M);
  Serial.print("Mhz processor with "); Serial.print(ArduinoBoardManager::SRAM_SIZE/k);
  Serial.print("k of SRAM and "); Serial.print(ArduinoBoardManager::FLASH_SIZE/k);
  Serial.println("k of flash.");
  Serial.println();
  
  // Board features (multiple serial ports on Mega, for example)
  if (arduino.featureExists(ArduinoBoardManager::FEATURE_MULTIPLE_SERIAL)) {
    Serial.println("Your board supports multiple serial connections");
  } else {
    Serial.println("Your board only supports one serial connection");
  }

  if (arduino.featureExists(ArduinoBoardManager::FEATURE_ANALOG_OUT)) {
    Serial.println("Your board supports analog out");
  }
  if (arduino.featureExists(ArduinoBoardManager::FEATURE_BLUETOOTH_4)) {
    Serial.println("Your board supports bluetooth 4");
  }
}


void loop() {
}

Serial output will resemble this (tested of Arduino UNO)

Board is compatible with Arduino UNO

SDK Version is: 10604

This UNO is an 8-bit, 16Mhz processor with 2k of SRAM and 32k of flash.

Your board only supports one serial connection.

arduinoboardmanager's People

Contributors

backupbrain avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.