Skip to content

KeeganMartin/Dictionary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Arduino Dictionary

This is a simple key-value dictionary for Arduino. It uses LinkedList (It has its own version within it to ensure compatibility). This library has had very little testing, so use at your own risk.

Installation

  1. Click Code > Download ZIP
  2. Open Arduino IDE
  3. From the Sketch menu select Include Library > Add .ZIP Library
  4. Navigate to Dictionary-master.zip
  5. Click Open

The IDE should say something like Library added to your libraries. Check "Include library" menu.

Usage

Include the library like this:

  #include <Dictionary.h>

Create an object with String keys and String values:

//Object with String keys and String values
Dictionary<String, String> MyDict = Dictionary<String, String>();

Or just

Dictionary<String, String> MyDict;

Set a value:

//Set a value when key and value are String
MyDict.set("MyKey", "MyValue");

Get a value:

//Get a value when a key is known
MyVal = MyDict.get("MyKey");

Get a key when value is known:

//Get a key when value is known
MyKey = MyDict.getKey("MyValue");

Get length of dictionary:

length = MyDict.length();