Example scripts for the Analog Shield that use the Arduino-style functions in arduino.py (from arduino import *) with analog_shield.py, in examples/arduino/analog_shield/. Each script has the shape of an Arduino sketch: setup() runs once, then loop() runs over and over. The main() at the end of each file starts them; leave it as it is. The same examples written with phyduino.py are on the phyduino.py examples page.
With analog_shield.py on the board, run a script from PyCharm, or with mpremote run examples/arduino/analog_shield/<name>/main.py. To have it run every time the board starts, copy its main.py to the board: mpremote cp examples/arduino/analog_shield/<name>/main.py :, then press RESET.
| Example | What it shows |
|---|---|
| Blink LEDs | Blinking the green and red LEDs in turn |
| Encoder Counter | Counting the encoder's clicks; a press sets it back to 0 |
| Encoder LED Brightness | Setting the green LED's brightness with the encoder |
| Read Pot | The potentiometer's reading on A5 |
| Temperature | The LMT84's temperature through the amplifier |
| Amplifier Chain | The voltage at each stage of the amplifier |