Hackster is hosting Hackster Holidays, Ep. 5: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 5 on Friday!
Published © CC BY-NC

The Blissful Bumble Bee

A blissful bumble bee that spreads wholesomeness throughout the internet!

IntermediateFull instructions providedOver 1 day292
The Blissful Bumble Bee

Things used in this project

Hardware components

Raspberry Pi 4 Model B
Raspberry Pi 4 Model B
×1
MG995 Servo
×1
Camera Module
Raspberry Pi Camera Module
×1
NeoPixel Ring: WS2812 5050 RGB LED
Adafruit NeoPixel Ring: WS2812 5050 RGB LED
×1
Felt
×1
Metal wire
×1
Hook and loop
×1

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Needle & thread
Glue

Story

Read more

Custom parts and enclosures

halfsphereflowerpod_CCZBxvuUe4.stl

Code

none.py

Python
# This is a dummy file to allow the automatic loading of modules without error on none.
import robot_util
import time
import json
from random import randrange
import neopixel
import board

# Data Setup
input_file_ff = open ('/home/pi/remotv/hardware/ff.json')
ffJson = json.load(input_file_ff)

input_file_ss = open ('/home/pi/remotv/hardware/ss.json')
ssJson = json.load(input_file_ss)

#NeoPixel Seup
import neopixel
import board
pixels = neopixel.NeoPixel(board.D18,30)
red = (252, 3, 3)
orange = (252, 177, 3)
yellow = (252, 248, 3)
green = (3, 252, 53)
blue = (0, 213, 255)
indigo = (115, 3, 252)
violet = (242, 0, 255)
rainbow = [red, orange, yellow, green, blue, indigo, violet]
nocolour = (0,0,0)

# Servo setup
from gpiozero import Servo
beeServo = Servo(26)


def setup(robot_config):
    pixels.brightness = 0.1
    return

def move(args):

    try:

        message = ''

        if args['button']['command'] == 'f':
            index = randrange(len(ffJson['messages']))
            colour = randrange(len(rainbow))
            message = ffJson['messages'][index]
            beeServo.max()
            pixels.fill(rainbow[colour])



        elif args['button']['command'] == 's':
            index = randrange(len(ssJson['messages']))
            colour = randrange(len(rainbow))
            message = ssJson['messages'][index]
            beeServo.max()
            pixels.fill(rainbow[colour])



        robot_util.sendChatMessage(message)

        time.sleep(3)
        beeServo.min()
        time.sleep(1)
        pixels.fill(nocolour)
        beeServo.detach()

    except:
        pass

    return

Credits

Comments