CRICKIT flying carousel @adafruit #adafruit #robot #robotics


IR remote control, voice prompts, DC motor control, NeoPixels… made with Adafruit CRICKIT (video) – more CRICKIT vids’ here (playlist) & here’s the code.


import gc

import pulseio

gc.collect()

import adafruit_irremote

gc.collect()

from adafruit_motor import motor

gc.collect()

from adafruit_seesaw.seesaw import Seesaw

gc.collect()

from adafruit_seesaw.pwmout import PWMOut

gc.collect()

import neopixel

gc.collect()

import audioio

gc.collect()

from busio import I2C

import board

import time





print("Blimp!")



# Create Infrared reader

pulsein = pulseio.PulseIn(board.REMOTEIN, maxlen=100, idle_state=True)

decoder = adafruit_irremote.GenericDecode()

REMOTE_FORWARD = [255, 2, 175, 80]

REMOTE_BACKWARD = [255, 2, 239, 16]

REMOTE_PAUSE = [255, 2, 127, 128]



# Create seesaw object

seesaw = Seesaw(I2C(board.SCL, board.SDA))



# Create one motor on seesaw PWM pins 22 & 23

motor_a = motor.DCMotor(PWMOut(seesaw, 22), PWMOut(seesaw, 23))

motor_a.throttle = 0



# Neopix!@

pixels = neopixel.NeoPixel(board.NEOPIXEL, 10)



# audio file

a = audioio.AudioOut(board.A0)

def play_audio(wavfile):

    f = open(wavfile, "rb")

    wav = audioio.WaveFile(f)

    a.play(wav)

    while a.playing:

	pass

    f.close()

    gc.collect()



play_audio("overview.wav")

t = time.monotonic()



while True:

    command = None   # assume no remote commands came in

    if len(pulsein) > 25:  # check in any IR data came in

	pulses = decoder.read_pulses(pulsein)

	try:

	    code = decoder.decode_bits(pulses, debug=False)

	    if code in (REMOTE_FORWARD, REMOTE_BACKWARD, REMOTE_PAUSE):

		# we only listen to a few different codes

		command = code

	    else:

		continue

	# on any failure, lets just restart

	except:

	    continue



    if command:

	if code == REMOTE_FORWARD:

	    play_audio("fan_forward.wav")

	    motor_a.throttle = 1  # full speed forward

	    pixels.fill((255,0,0))

	elif code == REMOTE_BACKWARD:

	    play_audio("fan_backward.wav")

	    motor_a.throttle = -1  # full speed backward

	    pixels.fill((0,0,255))

	elif code == REMOTE_PAUSE:

	    motor_a.throttle = 0  # stop motor

	    play_audio("fan_stopped.wav")

	    pixels.fill((0,0,0))

	time.sleep(0.5)



    # play yayayay every 3 seconds

    if (time.monotonic() - t > 3) and motor_a.throttle != 0:

	t = time.monotonic()

	play_audio("yayyayyay.wav")



Adafruit publishes a wide range of writing and video content, including interviews and reporting on the maker market and the wider technology world. Our standards page is intended as a guide to best practices that Adafruit uses, as well as an outline of the ethical standards Adafruit aspires to. While Adafruit is not an independent journalistic institution, Adafruit strives to be a fair, informative, and positive voice within the community – check it out here: adafruit.com/editorialstandards

Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on code.org, jump into CircuitPython to learn Python and hardware together, TinyGO, or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.

Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7:30pm ET! To join, head over to YouTube and check out the show’s live chat and our Discord!

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Join over 38,000+ makers on Adafruit’s Discord channels and be part of the community! http://adafru.it/discord

CircuitPython – The easiest way to program microcontrollers – CircuitPython.org


New Products – Adafruit Industries – Makers, hackers, artists, designers and engineers! — JP’s Product Pick of the Week @adafruit @johnedgarpark #adafruit #newproductpick

Python for Microcontrollers – Adafruit Daily — Python on Microcontrollers Newsletter: MicroPython v1.24.0 is here, a Halloween Wrap-up and Much More! #CircuitPython #Python #micropython @ThePSF @Raspberry_Pi

EYE on NPI – Adafruit Daily — EYE on NPI Maxim’s Himalaya uSLIC Step-Down Power Module #EyeOnNPI @maximintegrated @digikey

Adafruit IoT Monthly — Halloween, WiLo, and more!

Maker Business – Adafruit Daily — First Solar’s $1.1 billion development of vertically integrated factory in the U.S.

Electronics – Adafruit Daily — Oscilloscope Jumble

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !



1 Comment

  1. This is the *ultimate* use of the interwebitubes. I must stop now as my head has exploded.

    Lady Ada and PT: you will have to work very hard to top this one!

    Party on and Be Excellent To One Another!

Sorry, the comment form is closed at this time.