#!/usr/bin/python
# -*- coding: UTF8 -*-
# -----------------------------------------------
# Initalization of modules
# uses objects "tux" and "tss"
# -----------------------------------------------

import sys
sys.path.append('/opt/tuxdroid/api/python')
from tux import *

# -----------------------------------------------
# Script
# -----------------------------------------------

# initialization

tux.cmd.mouth_close()
tux.cmd.eyes_open()
tux.cmd.leds_off()

def laugh():
	tux.cmd.leds_on();
	tux.cmd.mouth_open();
	tux.sys.wait(1);
	tux.cmd.sound_play(8,0);
	tux.sys.wait(1);
	tux.cmd.mouth_close();
	tux.cmd.leds_off();
# body
laugh()
tux.event.on_head_bt_pushed=laugh

# -----------------------------------------------
# End of script
# -----------------------------------------------
tux.event.wait_remote_bt(K_STANDBY,9999)
tux.destroy()
