Anishwar:

I had success with getting the MQTT to work and get the furry creature to vibrate when Yael produces a loud noise. Additionally, I managed to get the furry creature to transmit when it has been touched.

Yael:

Anishwar was able to receive my data. The current bug we’re working on is getting his data to move my servo as well as slowing the transfer of data down so neither of us gets stuck because the other sent 10 signals at once.

I have also been working on finalizing the creature and its personality. The pleats are now truly working like window shades and the inside is quite enticing while the outside is rather plain.

# Write your code here :-)
    # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
    # SPDX-License-Identifier: MIT

   # """
    #This example prints out sound levels using the sound sensor on a Circuit Playground Bluefruit.
    #Try making sounds towards the board to see the values change.

    #NOTE: This example does NOT support Circuit Playground Express.
    # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
    # SPDX-License-Identifier: MIT

    #"""
    #This example lights up the NeoPixels on a Circuit Playground Bluefruit in response to a loud sound.
    #Try snapping or clapping near the board to trigger the LEDs.

    #NOTE: This example does NOT support Circuit Playground Express.

import time
from adafruit_circuitplayground import cp
    # Import the low-level hardware libraries.
import supervisor
import board
import pwmio
import digitalio
import analogio
import pulseio
import sys
    # Import the Adafruit helper library.
from adafruit_motor import servo

# Configure the NeoPixel LED array for bulk update using show().
cp.pixels.auto_write = False

    # Initialize hardware.

    # Create a PWMOut object on pad SDA A5 to generate control signals.
pwm = pulseio.PWMOut(board.A5, frequency=50)

    # Create a Servo object which controls a hobby servo using the PWMOut.
actuator = servo.Servo(pwm, min_pulse=1000, max_pulse=2000)

     # When there is a loud sound put the servo motor in a position where it sucks air out of the pneumatic.
actuator.angle = 10

# The display update rate is precisely regulated using the following timer variables.
# The default is 20 Hz frame rate as set by step_interval.
step_timer    = 0.0
last_time     = time.monotonic()
step_interval = 0.05

# The core model state is an array of state variables.  Note that the state is
# modeled for 12 uniformly spaced positions, even though only ten are populated
# with NeoPixels.  This state is abstract but might represent heat moving
# through a ring of material.
state = [0.0] * 12  # create 12 element array of zeros

while True:
        # Measure elapsed time and wait until the update timer has elapsed.
    now = time.monotonic()
    interval = now - last_time
    last_time = now
    step_timer -= interval
    if step_timer < 0.0:
        step_timer += step_interval

        # Apply a first-order diffusion model to the state.  This loop creates a new
        # array to replace the previous state.  The modulo operator (%) is used to 'wrap
        # around' the end of the array to close the loop.
        N = len(state)
        new = [0.0] * N
        for i in range(N):
            new[i] = 0.9 * state[i] + 0.05 * state[(i-1) % N] + 0.05 * state[(i+1) % N]

        # Replace the previous state.
        state = new

        # Apply a slow decay to represent leakage outside the ring.
        for i in range(N):
            state[i] = 0.97 * state[i]

        # Apply touch inputs as excitation blended into nearby samples.
        if cp.touch_A1: state[8]  += 0.1 * (1.0 - state[ 8])
        if cp.touch_A2: state[10] += 0.1 * (1.0 - state[10])
        if cp.touch_A3:
            state[11] += 0.1 * (1.0 - state[11])
            print("touch")
        if cp.touch_A4: state[ 2] += 0.1 * (1.0 - state[ 2])
        if cp.touch_A6: state[ 4] += 0.1 * (1.0 - state[ 4])

        # Update the LED colors to reflect the state.  Note that states 0 and 6
        # are invisible as these positions do not have LEDs.
        for i, s in enumerate(state):
            if i != 0 and i != 6:
                # Clamp the state value between 0.0 and 1.0.
                value = min(max(s, 0.0), 1.0)

                # Map the state index to an LED position index.
                pos = i-1 if i < 6 else i-2

                # Map 0.0 to dim blue and 1.0 to bright red.
                cp.pixels[pos] = (255 * value, 0, 50 * (1.0 - value))


        cp.pixels.show()
        '''
        if cp.loud_sound(sound_threshold = 400):
            print("something")
            for vibrateNumber in range(20.0):
                actuator.angle = 30
                time.sleep(.25)
                actuator.angle = 10
                time.sleep(.25)
        else:
            actuator.angle = 10
        '''

        if supervisor.runtime.serial_bytes_available:
            line = sys.stdin.readline()
            tokens = line.split()
            for vibrateNumber in range(20):
                actuator.angle = 30
                time.sleep(.25)
                actuator.angle = 10
                time.sleep(.25)