{
  "format": "evn-blocks",
  "version": 3,
  "title": "ADC: every block",
  "needs": "the ADC module on I2C port 1, and voltages of 0 to 3.3 V on A0..A3 (for example a potentiometer between the board's 3.3 V and GND pins, its middle pin on A0); never more than 3.3 V on a pin",
  "description": "The voltage on all four inputs, A0 to A3, twice a second for 10 s. An input with nothing wired to it floats: it reads a wandering few tenths of a volt, not 0.",
  "workspace": {
    "blocks": {
      "languageVersion": 0,
      "blocks": [
        {
          "type": "evn_setup_start",
          "x": 30,
          "y": 30,
          "next": {
            "block": {
              "type": "evn_adc_setup",
              "fields": {
                "PORT": "1"
              }
            }
          }
        },
        {
          "type": "evn_program_start",
          "x": 30,
          "y": 115,
          "next": {
            "block": {
              "type": "evn_comment",
              "fields": {
                "TEXT": "the set-up block has the ADC measure all four inputs in turn"
              },
              "next": {
                "block": {
                  "type": "controls_repeat_ext",
                  "inputs": {
                    "TIMES": {
                      "shadow": {
                        "type": "math_number",
                        "fields": {
                          "NUM": 20
                        }
                      }
                    },
                    "DO": {
                      "block": {
                        "type": "text_print",
                        "inputs": {
                          "TEXT": {
                            "block": {
                              "type": "text_join",
                              "inputs": {
                                "ADD0": {
                                  "shadow": {
                                    "type": "text",
                                    "fields": {
                                      "TEXT": "A0 V "
                                    }
                                  }
                                },
                                "ADD1": {
                                  "block": {
                                    "type": "evn_adc_voltage",
                                    "fields": {
                                      "PORT": "1"
                                    },
                                    "inputs": {
                                      "INPUT": {
                                        "shadow": {
                                          "type": "math_number",
                                          "fields": {
                                            "NUM": 0
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        },
                        "next": {
                          "block": {
                            "type": "text_print",
                            "inputs": {
                              "TEXT": {
                                "block": {
                                  "type": "text_join",
                                  "inputs": {
                                    "ADD0": {
                                      "shadow": {
                                        "type": "text",
                                        "fields": {
                                          "TEXT": "A1 V "
                                        }
                                      }
                                    },
                                    "ADD1": {
                                      "block": {
                                        "type": "evn_adc_voltage",
                                        "fields": {
                                          "PORT": "1"
                                        },
                                        "inputs": {
                                          "INPUT": {
                                            "shadow": {
                                              "type": "math_number",
                                              "fields": {
                                                "NUM": 1
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            },
                            "next": {
                              "block": {
                                "type": "text_print",
                                "inputs": {
                                  "TEXT": {
                                    "block": {
                                      "type": "text_join",
                                      "inputs": {
                                        "ADD0": {
                                          "shadow": {
                                            "type": "text",
                                            "fields": {
                                              "TEXT": "A2 V "
                                            }
                                          }
                                        },
                                        "ADD1": {
                                          "block": {
                                            "type": "evn_adc_voltage",
                                            "fields": {
                                              "PORT": "1"
                                            },
                                            "inputs": {
                                              "INPUT": {
                                                "shadow": {
                                                  "type": "math_number",
                                                  "fields": {
                                                    "NUM": 2
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                },
                                "next": {
                                  "block": {
                                    "type": "text_print",
                                    "inputs": {
                                      "TEXT": {
                                        "block": {
                                          "type": "text_join",
                                          "inputs": {
                                            "ADD0": {
                                              "shadow": {
                                                "type": "text",
                                                "fields": {
                                                  "TEXT": "A3 V "
                                                }
                                              }
                                            },
                                            "ADD1": {
                                              "block": {
                                                "type": "evn_adc_voltage",
                                                "fields": {
                                                  "PORT": "1"
                                                },
                                                "inputs": {
                                                  "INPUT": {
                                                    "shadow": {
                                                      "type": "math_number",
                                                      "fields": {
                                                        "NUM": 3
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    },
                                    "next": {
                                      "block": {
                                        "type": "evn_wait",
                                        "inputs": {
                                          "TIME": {
                                            "shadow": {
                                              "type": "math_number",
                                              "fields": {
                                                "NUM": 500
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      ]
    }
  }
}
