sensors_feather-m4-express-colour-and-signal-generator.jpg
Feather M4 Express used as signal generator and colour source for demonstrating sensor plotter on CLUE.

A Feather M4 Express board was enlisted to aid the demonstration of the sensor plotter in the video on the previous page. It provided:

  • alternating red, green blue light from the onboard NeoPixel for the CLUE's APDS-9960 colour sensor;
  • two analogue signals from A0 and A1 which were connected to the #0 and #1 pads on the CLUE using some test hooks.

Its SAMD51 (M4) processor is useful here as it has 2 DACs.

The code running on the board was very short and simply typed in over the serial console on CircuitPython's REPL.

import audioio, audiocore, board, neopixel, time

dacpair = audioio.AudioOut(board.A0,
                           right_channel=board.A1)
filename = "adafruit-spinning-logo-plot-2chan.wav"
wav_file = open(filename, "rb")
samples = audiocore.WaveFile(wav_file)
samples.sample_rate = 500
dacpair.play(samples, loop=True)
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1)

# Loop forever showing r, g, b while the
# DACs continue to loop the samples from wav file
while True:
    pixel[0] = (255, 0, 0)  # red
    time.sleep(0.5)
    pixel[0] = (0, 255, 0)  # green
    time.sleep(0.5)
    pixel[0] = (0, 0, 255)  # blue
    time.sleep(0.5)

Wav files are typically used for audio but they can be used for any signal. In this case the adafruit-spinning-logo-plot-2chan.wav has two signals following the top and bottom outline of the Adafruit logo, spinning 1/5th of a revolution in total across five frames.

Adafruit Feather M4 Express - Featuring ATSAMD51
It's what you've been waiting for, the Feather M4 Express featuring ATSAMD51. This Feather is fast like a swift, smart like an owl, strong like a ox-bird (it's half ox,...
Out of Stock
Basic Multi-Color Micro SMT Test Hooks (6-pack)
Testing and debugging is a challenging step in board manufacturing. It can be super tricky on a fully populated PCB. So how can you test connections when you have an assortment of...
Out of Stock

This guide was first published on Apr 01, 2020. It was last updated on Apr 01, 2020.

This page (Signal/Colour Generator) was last updated on May 16, 2021.

Text editor powered by tinymce.