{
  "format": "evn-blocks",
  "version": 3,
  "title": "LED matrix: every block",
  "needs": "the 8x8 LED matrix on I2C port 1",
  "description": "Every LED matrix block once: icons, numbers, scrolling text, one letter, single pixels and the brightness, ending with a blank matrix at full brightness.",
  "workspace": {
    "blocks": {
      "languageVersion": 0,
      "blocks": [
        {
          "type": "evn_setup_start",
          "x": 30,
          "y": 30,
          "next": {
            "block": {
              "type": "evn_matrix_setup",
              "fields": {
                "PORT": "1"
              }
            }
          }
        },
        {
          "type": "evn_program_start",
          "x": 30,
          "y": 115,
          "next": {
            "block": {
              "type": "evn_comment",
              "fields": {
                "TEXT": "pictures: a few of the built-in icons"
              },
              "next": {
                "block": {
                  "type": "evn_matrix_icon",
                  "fields": {
                    "PORT": "1",
                    "ICON": "HAPPY"
                  },
                  "next": {
                    "block": {
                      "type": "evn_wait",
                      "inputs": {
                        "TIME": {
                          "shadow": {
                            "type": "math_number",
                            "fields": {
                              "NUM": 1000
                            }
                          }
                        }
                      },
                      "next": {
                        "block": {
                          "type": "evn_matrix_icon",
                          "fields": {
                            "PORT": "1",
                            "ICON": "ARROW_UP"
                          },
                          "next": {
                            "block": {
                              "type": "evn_wait",
                              "inputs": {
                                "TIME": {
                                  "shadow": {
                                    "type": "math_number",
                                    "fields": {
                                      "NUM": 1000
                                    }
                                  }
                                }
                              },
                              "next": {
                                "block": {
                                  "type": "evn_comment",
                                  "fields": {
                                    "TEXT": "brightness 1 (dim) .. 16 (bright, where it starts); the whole matrix at once"
                                  },
                                  "next": {
                                    "block": {
                                      "type": "controls_for",
                                      "fields": {
                                        "VAR": {
                                          "id": "v_level"
                                        }
                                      },
                                      "inputs": {
                                        "FROM": {
                                          "shadow": {
                                            "type": "math_number",
                                            "fields": {
                                              "NUM": 1
                                            }
                                          }
                                        },
                                        "TO": {
                                          "shadow": {
                                            "type": "math_number",
                                            "fields": {
                                              "NUM": 16
                                            }
                                          }
                                        },
                                        "BY": {
                                          "shadow": {
                                            "type": "math_number",
                                            "fields": {
                                              "NUM": 1
                                            }
                                          }
                                        },
                                        "DO": {
                                          "block": {
                                            "type": "evn_matrix_brightness",
                                            "fields": {
                                              "PORT": "1"
                                            },
                                            "inputs": {
                                              "LEVEL": {
                                                "block": {
                                                  "type": "variables_get",
                                                  "fields": {
                                                    "VAR": {
                                                      "id": "v_level"
                                                    }
                                                  }
                                                }
                                              }
                                            },
                                            "next": {
                                              "block": {
                                                "type": "evn_wait",
                                                "inputs": {
                                                  "TIME": {
                                                    "shadow": {
                                                      "type": "math_number",
                                                      "fields": {
                                                        "NUM": 100
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      },
                                      "next": {
                                        "block": {
                                          "type": "evn_comment",
                                          "fields": {
                                            "TEXT": "numbers -99 .. 99"
                                          },
                                          "next": {
                                            "block": {
                                              "type": "controls_for",
                                              "fields": {
                                                "VAR": {
                                                  "id": "v_n"
                                                }
                                              },
                                              "inputs": {
                                                "FROM": {
                                                  "shadow": {
                                                    "type": "math_number",
                                                    "fields": {
                                                      "NUM": -3
                                                    }
                                                  }
                                                },
                                                "TO": {
                                                  "shadow": {
                                                    "type": "math_number",
                                                    "fields": {
                                                      "NUM": 3
                                                    }
                                                  }
                                                },
                                                "BY": {
                                                  "shadow": {
                                                    "type": "math_number",
                                                    "fields": {
                                                      "NUM": 1
                                                    }
                                                  }
                                                },
                                                "DO": {
                                                  "block": {
                                                    "type": "evn_matrix_number",
                                                    "fields": {
                                                      "PORT": "1"
                                                    },
                                                    "inputs": {
                                                      "NUMBER": {
                                                        "block": {
                                                          "type": "variables_get",
                                                          "fields": {
                                                            "VAR": {
                                                              "id": "v_n"
                                                            }
                                                          }
                                                        }
                                                      }
                                                    },
                                                    "next": {
                                                      "block": {
                                                        "type": "evn_wait",
                                                        "inputs": {
                                                          "TIME": {
                                                            "shadow": {
                                                              "type": "math_number",
                                                              "fields": {
                                                                "NUM": 500
                                                              }
                                                            }
                                                          }
                                                        }
                                                      }
                                                    }
                                                  }
                                                }
                                              },
                                              "next": {
                                                "block": {
                                                  "type": "evn_matrix_number",
                                                  "fields": {
                                                    "PORT": "1"
                                                  },
                                                  "inputs": {
                                                    "NUMBER": {
                                                      "shadow": {
                                                        "type": "math_number",
                                                        "fields": {
                                                          "NUM": 42
                                                        }
                                                      }
                                                    }
                                                  },
                                                  "next": {
                                                    "block": {
                                                      "type": "evn_wait",
                                                      "inputs": {
                                                        "TIME": {
                                                          "shadow": {
                                                            "type": "math_number",
                                                            "fields": {
                                                              "NUM": 1000
                                                            }
                                                          }
                                                        }
                                                      },
                                                      "next": {
                                                        "block": {
                                                          "type": "evn_comment",
                                                          "fields": {
                                                            "TEXT": "text: one letter at a time; the program waits until it is over"
                                                          },
                                                          "next": {
                                                            "block": {
                                                              "type": "evn_matrix_text",
                                                              "fields": {
                                                                "PORT": "1"
                                                              },
                                                              "inputs": {
                                                                "TEXT": {
                                                                  "shadow": {
                                                                    "type": "text",
                                                                    "fields": {
                                                                      "TEXT": "EVN"
                                                                    }
                                                                  }
                                                                }
                                                              },
                                                              "next": {
                                                                "block": {
                                                                  "type": "evn_comment",
                                                                  "fields": {
                                                                    "TEXT": "one letter that stays"
                                                                  },
                                                                  "next": {
                                                                    "block": {
                                                                      "type": "evn_matrix_char",
                                                                      "fields": {
                                                                        "PORT": "1"
                                                                      },
                                                                      "inputs": {
                                                                        "CHAR": {
                                                                          "shadow": {
                                                                            "type": "text",
                                                                            "fields": {
                                                                              "TEXT": "A"
                                                                            }
                                                                          }
                                                                        }
                                                                      },
                                                                      "next": {
                                                                        "block": {
                                                                          "type": "evn_wait",
                                                                          "inputs": {
                                                                            "TIME": {
                                                                              "shadow": {
                                                                                "type": "math_number",
                                                                                "fields": {
                                                                                  "NUM": 1000
                                                                                }
                                                                              }
                                                                            }
                                                                          },
                                                                          "next": {
                                                                            "block": {
                                                                              "type": "evn_comment",
                                                                              "fields": {
                                                                                "TEXT": "single pixels: row from the top, column from the left, 0 .. 7"
                                                                              },
                                                                              "next": {
                                                                                "block": {
                                                                                  "type": "evn_matrix_clear",
                                                                                  "fields": {
                                                                                    "PORT": "1"
                                                                                  },
                                                                                  "next": {
                                                                                    "block": {
                                                                                      "type": "controls_for",
                                                                                      "fields": {
                                                                                        "VAR": {
                                                                                          "id": "v_i"
                                                                                        }
                                                                                      },
                                                                                      "inputs": {
                                                                                        "FROM": {
                                                                                          "shadow": {
                                                                                            "type": "math_number",
                                                                                            "fields": {
                                                                                              "NUM": 0
                                                                                            }
                                                                                          }
                                                                                        },
                                                                                        "TO": {
                                                                                          "shadow": {
                                                                                            "type": "math_number",
                                                                                            "fields": {
                                                                                              "NUM": 7
                                                                                            }
                                                                                          }
                                                                                        },
                                                                                        "BY": {
                                                                                          "shadow": {
                                                                                            "type": "math_number",
                                                                                            "fields": {
                                                                                              "NUM": 1
                                                                                            }
                                                                                          }
                                                                                        },
                                                                                        "DO": {
                                                                                          "block": {
                                                                                            "type": "evn_matrix_pixel",
                                                                                            "fields": {
                                                                                              "PORT": "1",
                                                                                              "ON": "TRUE"
                                                                                            },
                                                                                            "inputs": {
                                                                                              "ROW": {
                                                                                                "block": {
                                                                                                  "type": "variables_get",
                                                                                                  "fields": {
                                                                                                    "VAR": {
                                                                                                      "id": "v_i"
                                                                                                    }
                                                                                                  }
                                                                                                }
                                                                                              },
                                                                                              "COL": {
                                                                                                "block": {
                                                                                                  "type": "variables_get",
                                                                                                  "fields": {
                                                                                                    "VAR": {
                                                                                                      "id": "v_i"
                                                                                                    }
                                                                                                  }
                                                                                                }
                                                                                              }
                                                                                            },
                                                                                            "next": {
                                                                                              "block": {
                                                                                                "type": "evn_wait",
                                                                                                "inputs": {
                                                                                                  "TIME": {
                                                                                                    "shadow": {
                                                                                                      "type": "math_number",
                                                                                                      "fields": {
                                                                                                        "NUM": 150
                                                                                                      }
                                                                                                    }
                                                                                                  }
                                                                                                }
                                                                                              }
                                                                                            }
                                                                                          }
                                                                                        }
                                                                                      },
                                                                                      "next": {
                                                                                        "block": {
                                                                                          "type": "controls_for",
                                                                                          "fields": {
                                                                                            "VAR": {
                                                                                              "id": "v_i"
                                                                                            }
                                                                                          },
                                                                                          "inputs": {
                                                                                            "FROM": {
                                                                                              "shadow": {
                                                                                                "type": "math_number",
                                                                                                "fields": {
                                                                                                  "NUM": 0
                                                                                                }
                                                                                              }
                                                                                            },
                                                                                            "TO": {
                                                                                              "shadow": {
                                                                                                "type": "math_number",
                                                                                                "fields": {
                                                                                                  "NUM": 7
                                                                                                }
                                                                                              }
                                                                                            },
                                                                                            "BY": {
                                                                                              "shadow": {
                                                                                                "type": "math_number",
                                                                                                "fields": {
                                                                                                  "NUM": 1
                                                                                                }
                                                                                              }
                                                                                            },
                                                                                            "DO": {
                                                                                              "block": {
                                                                                                "type": "evn_matrix_pixel",
                                                                                                "fields": {
                                                                                                  "PORT": "1",
                                                                                                  "ON": "FALSE"
                                                                                                },
                                                                                                "inputs": {
                                                                                                  "ROW": {
                                                                                                    "block": {
                                                                                                      "type": "variables_get",
                                                                                                      "fields": {
                                                                                                        "VAR": {
                                                                                                          "id": "v_i"
                                                                                                        }
                                                                                                      }
                                                                                                    }
                                                                                                  },
                                                                                                  "COL": {
                                                                                                    "block": {
                                                                                                      "type": "variables_get",
                                                                                                      "fields": {
                                                                                                        "VAR": {
                                                                                                          "id": "v_i"
                                                                                                        }
                                                                                                      }
                                                                                                    }
                                                                                                  }
                                                                                                },
                                                                                                "next": {
                                                                                                  "block": {
                                                                                                    "type": "evn_wait",
                                                                                                    "inputs": {
                                                                                                      "TIME": {
                                                                                                        "shadow": {
                                                                                                          "type": "math_number",
                                                                                                          "fields": {
                                                                                                            "NUM": 150
                                                                                                          }
                                                                                                        }
                                                                                                      }
                                                                                                    }
                                                                                                  }
                                                                                                }
                                                                                              }
                                                                                            }
                                                                                          },
                                                                                          "next": {
                                                                                            "block": {
                                                                                              "type": "evn_comment",
                                                                                              "fields": {
                                                                                                "TEXT": "the end: a blank matrix"
                                                                                              },
                                                                                              "next": {
                                                                                                "block": {
                                                                                                  "type": "evn_matrix_clear",
                                                                                                  "fields": {
                                                                                                    "PORT": "1"
                                                                                                  }
                                                                                                }
                                                                                              }
                                                                                            }
                                                                                          }
                                                                                        }
                                                                                      }
                                                                                    }
                                                                                  }
                                                                                }
                                                                              }
                                                                            }
                                                                          }
                                                                        }
                                                                      }
                                                                    }
                                                                  }
                                                                }
                                                              }
                                                            }
                                                          }
                                                        }
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      ]
    },
    "variables": [
      {
        "name": "level",
        "id": "v_level"
      },
      {
        "name": "n",
        "id": "v_n"
      },
      {
        "name": "i",
        "id": "v_i"
      }
    ]
  }
}
