examples.rst 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. Examples
  2. ========
  3. This page contains a few examples.
  4. Speaker
  5. -------
  6. .. literalinclude:: ../../examples/flipperzero_speaker_test.py
  7. :language: python
  8. Input
  9. -----
  10. .. literalinclude:: ../../examples/flipperzero_draw_on_input_test.py
  11. :language: python
  12. Tic-Tac-Toe
  13. -----------
  14. .. literalinclude:: ../../examples/tic_tac_toe.py
  15. :language: python
  16. Interrupts
  17. ----------
  18. .. literalinclude:: ../../examples/flipperzero_gpio_interrupt_test.py
  19. :language: python
  20. This example drives an external LED upon interrupts: A rising edge on ``C0`` sets the pin ``A7`` to high, a rising edge on ``C1`` sets the pin ``A7`` to low.
  21. The following schematic circuit diagram shows the hardware setup for this example:
  22. .. figure:: ./assets/gpio_interrupt_circuit.svg
  23. :width: 90%
  24. Hardware setup for the GPIO interrupt example.
  25. ADC
  26. ---
  27. .. literalinclude:: ../../examples/flipperzero_adc_test.py
  28. :language: python
  29. This example uses a voltage divider with the 3.3 V source from pin 9. The switch ``S1`` changes the input voltage on ``C1`` between 0 and about 0.8 V.
  30. .. figure:: ./assets/adc_circuit.svg
  31. :width: 90%
  32. Hardware setup for the ADC example.