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.
- Click Code > Download ZIP
- Open Arduino IDE
- From the Sketch menu select Include Library > Add .ZIP Library
- Navigate to Dictionary-master.zip
- Click Open
The IDE should say something like Library added to your libraries. Check "Include library" menu.
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();