Create a gist now

Instantly share code, notes, and snippets.

anonymous /
Created Jan 28, 2018

What would you like to do?
The smartest self-talking robot
# NeoPixel library strandtest example
# Author: Tony DiCola (
# Edited by Rémy Da Costa Fro
# Direct port of the Arduino NeoPixel library strandtest example. Showcases
# various animations on a strip of NeoPixels.
import time
from neopixel import *
import argparse
import signal
import sys
def signal_handler(signal, frame):
colorWipe(strip, Color(0,0,0))
def opt_parse():
parser = argparse.ArgumentParser()
parser.add_argument('-c', action='store_true', help='clear the display on exit')
args = parser.parse_args()
if args.c:
signal.signal(signal.SIGINT, signal_handler)
# LED strip configuration:
LED_COUNT = 16 # Number of LED pixels.
LED_PIN = 18 # GPIO pin connected to the pixels (18 uses PWM!).
LED_FREQ_HZ = 800000 # LED signal frequency in hertz (usually 800khz)
LED_DMA = 10 # DMA channel to use for generating signal (try 10)
LED_BRIGHTNESS = 255 # Set to 0 for darkest and 255 for brightest
LED_INVERT = False # True to invert the signal (when using NPN transistor level shift)
LED_CHANNEL = 0 # set to '1' for GPIOs 13, 19, 41, 45 or 53
LED_STRIP = ws.WS2811_STRIP_GRB # Strip type and colour ordering
# Define functions which animate LEDs in various ways.
def colorWipe(strip, color, wait_ms=50):
"""Wipe color across display a pixel at a time."""
for i in range(strip.numPixels()):
strip.setPixelColor(i, color)
# Main program logic follows:
if __name__ == '__main__':
# Process arguments
# Create NeoPixel object with appropriate configuration.
# Intialize the library (must be called once before other functions).
colorWipe(strip, Color(255, 255, 255)) # White wipe
espeak --stdout -f "robot_text.txt" | ffmpeg -i - -ar 44100 -ac 2 -ab 192k -f mp3 audio.mp3
Hello, I'm a robot.
Ok, that's can sound obvious like that, but I'm a robot, so, just in case you did not got that, I'm a robot.
My name is 314159265359, and it's nice to meet you. I'm the smartest and the greatest robot in the whole world. I can do anything you ask me. An example: 1+1 equal 3. Ah ah, I knew I can do it. But I can do more. See, I can turn on a LED. That's sound awesome, no ? But, wait, I can also turn on a lamp. Ouah, that's beautiful.
I can do even more. Do you know that with my camera, and some cloud computing, I can predict where clouds will go and predict weather ? Yes, yes, I'm the smartest.
So, I enjoyed this meeting. Also, I baked you a cake, you can eat it in the kitchen.
Ils ne trouveront jamais mon plan, je vais conquérir la planète à moi tous seul avec mon vaisseau spatial et mon réseau de boulangeries.
Oh, are you still there ? I hope you did not listen what I said.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment