Simple tests

Ensure your device works with these simple tests.

examples/waveform_sine_simpletest.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

"""
'sine_demo.py'.

=================================================
toggles the builtin LED using a sine wave
"""
import time
import board
import digitalio
from adafruit_waveform import sine

LED = digitalio.DigitalInOut(board.D13)
LED.switch_to_output()

SINE_SAMPLE = sine.sine_wave(150, 50)

while True:
    for i in range(len(SINE_SAMPLE)):
        LED.value = i
        print(LED.value)
        time.sleep(0.50)
examples/waveform_square_simpletest.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

"""
'square_demo.py'.

=================================================
toggles the builtin LED using a square wave
"""
import time
import digitalio
import board
from adafruit_waveform import square

LED = digitalio.DigitalInOut(board.D13)
LED.switch_to_output()
SAMPLE_SQUARE = square.square_wave(2)

while True:
    for i in range(len(SAMPLE_SQUARE)):
        LED.value = i
        print(LED.value)
        time.sleep(0.5)