Configurable Settings

Let’s look at the configuration for our stock “hazel” human eye. It doesn’t reference every configurable setting, but shows the general format of these files…

Download: file
{
  "eyeRadius"     : 125,
  "eyelidIndex"   : "0x00", // From table: learn.adafruit.com/assets/61921
  "pupilColor"    : [ 0, 0, 0 ],
  "backColor"     : [ 140, 40, 20 ],
  "irisTexture"   : "hazel/iris.bmp",
  "scleraTexture" : "hazel/sclera.bmp",
  "upperEyelid"   : "hazel/upper.bmp",
  "lowerEyelid"   : "hazel/lower.bmp",
  "left" : {
  },
  "right" : {
  }
}

This is a plain text file that any simple editor should be able to handle…Notepad or TextEdit or whatever comes bundled on your computer.

It’s worth reiterating these points from the “Customization Basics” page:

  • The whole thing is contained within curly braces{ and }
  • Each item has a name (always in quotes), a colon separator: ) and a value. Values might be numbers, strings (in quotes) or arrays (in square brackets) depending on what’s being configured.
  • This is a list and each line ends with a commaexcept for the last item in the list. Watch out for missing or surplus commas!
  • JSON is case-sensitive. "Foo", "foo" and "FOO" are all different things.
  • Using extra spaces to line up columns really isn’t necessary, just something I do to assist with legibility. Some folks just find it annoying.
  • Comments (starting with // ) are not standard JSON syntax, but the library we use allows them and I find them very helpful.

The “Customization Basics” page also has some JSON troubleshooting tips. If you encounter trouble, review that page!

This guide was first published on Aug 20, 2019. It was last updated on Aug 20, 2019. This page (Configurable Settings) was last updated on Feb 15, 2020.