from rstem import speaker

# Make the RaspberryPi say "Hello World"
speaker.say("Hello World", wait=True)

# TODO: should we do speaker.say() or my_speech thing?

## create a variable my_speech that is the converted text into sound
#my_speech = speaker.Speech("Hello World")

## play that sound tell it to wait until the sound has stopped playing before finishing the program
#my_speech.play(wait=True)
Example #2
0
from rstem import led_matrix, speaker
import time
import os

led_matrix.init_grid(
)  # This sets up the led matrix. It must be run before displaying anything.
led_matrix.erase(
)  # This clears the led matrix display incase anything is currently being displayed.

# 1. Create sprite variables of a face with mouth open and closed from .spr files.
mouth_closed = led_matrix.LEDSprite(os.path.abspath("mouth_closed.spr"))
mouth_open = led_matrix.LEDSprite(os.path.abspath("mouth_open.spr"))

# 2. Make the RaspberryPi say "Hello World"
speaker.say("Hello World")

# 3. Create a while loop that keeps looping until the Raspberry Pi has stopped talking.
while speaker.is_talking():
    # 4. Clear the led matrix
    led_matrix.erase()

    # 5. Draw the face with its mouth open
    led_matrix.sprite(mouth_open)

    # 6. Show the new face on the display and add a delay
    led_matrix.show()
    time.sleep(.1)

    # 7. Clear the led matrix of the previous face
    led_matrix.erase()
from rstem import speaker

# Make the RaspberryPi say "Hello World"
speaker.say("Hello World", wait=True)

# TODO: should we do speaker.say() or my_speech thing?

## create a variable my_speech that is the converted text into sound
#my_speech = speaker.Speech("Hello World") 

## play that sound tell it to wait until the sound has stopped playing before finishing the program
#my_speech.play(wait=True)
Example #4
0
from rstem import led_matrix, speaker
import time
import os

led_matrix.init_grid()  # This sets up the led matrix. It must be run before displaying anything.
led_matrix.erase()      # This clears the led matrix display incase anything is currently being displayed.

# 1. Create sprite variables of a face with mouth open and closed from .spr files.
mouth_closed = led_matrix.LEDSprite(os.path.abspath("mouth_closed.spr"))
mouth_open = led_matrix.LEDSprite(os.path.abspath("mouth_open.spr"))


# 2. Make the RaspberryPi say "Hello World"
speaker.say("Hello World")

# 3. Create a while loop that keeps looping until the Raspberry Pi has stopped talking.
while speaker.is_talking():
    # 4. Clear the led matrix
    led_matrix.erase()
    
    # 5. Draw the face with its mouth open
    led_matrix.sprite(mouth_open)
    
    # 6. Show the new face on the display and add a delay
    led_matrix.show()
    time.sleep(.1)
    
    # 7. Clear the led matrix of the previous face
    led_matrix.erase()
    
    # 8. Draw the face with its mouth closed
led_matrix.init_grid()  # This sets up the led matrix. It must be run before displaying anything.
led_matrix.erase()      # This clears the led matrix display incase anything is currently being displayed.

# Create sprite variables of a face with mouth open and closed from .spr files.
mouth_closed = led_matrix.LEDSprite(os.path.abspath("mouth_closed.spr"))
mouth_open = led_matrix.LEDSprite(os.path.abspath("mouth_open.spr"))

## Create a speech object of "Hello World"
#my_speech = speaker.Speech("Hello World")

## Play my_speech
#my_speech.play()

# Start speaking the text
speaker.say("Hello World", wait=False)

# Create a while loop that keeps looping until the Raspberry Pi has stopped talking.
while speaker.is_talking():

    # Clear the led matrix
    led_matrix.erase()
    
    # Draw the face with its mouth open
    led_matrix.sprite(mouth_open)
    
    # Show the new face on the display and add a delay
    led_matrix.show()
    time.sleep(.1)
    
    # Clear the led matrix of the previous face
Example #6
0
)  # This sets up the led matrix. It must be run before displaying anything.
led_matrix.erase(
)  # This clears the led matrix display incase anything is currently being displayed.

# Create sprite variables of a face with mouth open and closed from .spr files.
mouth_closed = led_matrix.LEDSprite(os.path.abspath("mouth_closed.spr"))
mouth_open = led_matrix.LEDSprite(os.path.abspath("mouth_open.spr"))

## Create a speech object of "Hello World"
#my_speech = speaker.Speech("Hello World")

## Play my_speech
#my_speech.play()

# Start speaking the text
speaker.say("Hello World", wait=False)

# Create a while loop that keeps looping until the Raspberry Pi has stopped talking.
while speaker.is_talking():

    # Clear the led matrix
    led_matrix.erase()

    # Draw the face with its mouth open
    led_matrix.sprite(mouth_open)

    # Show the new face on the display and add a delay
    led_matrix.show()
    time.sleep(.1)

    # Clear the led matrix of the previous face