The pleats are finally working with the syringe and a small hinge inflatable. The next step to finish this all up and put it together is to connect it between the two devices through MQTT.
I managed to create a working prototype of the small furry creature that responds to both touch and vibrates. When one strokes the fur, the bluefruit lights up in response to the touch. When there is a loud sound, the fur vibrates because it is attached to the servomotor.
# 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 board import pwmio import digitalio import analogio import pulseio # 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 += 0.1 * (1.0 - state[ 8]) if cp.touch_A2: state += 0.1 * (1.0 - state) if cp.touch_A3: state += 0.1 * (1.0 - state) if cp.touch_A4: state[ 2] += 0.1 * (1.0 - state[ 2]) #if cp.touch_A5: state[ 3] += 0.1 * (1.0 - state[ 3]) 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)) # If a loud sound is detected, override the normal display to flash white. # A physical tap will also trigger the flash. #if cp.loud_sound(): #cp.pixels.fill((255,255,255)) # Send new data to the physical LED chain. cp.pixels.show() if cp.loud_sound(sound_threshold = 300): print("something") for vibrateNumber in range(20.0): actuator.angle = 30 time.sleep(.25) actuator.angle = 10 time.sleep(.25) else: actuator.angle = 10