Exemplo n.º 1
0
def set_led_brightness(brightness):
    if brightness < 0:
        brightness = 0
    elif brightness > 100:
        brightness = 100

    led = LED()
    led.brightness = int(brightness)
    msg = "[PiSmart] Set LED brightness %d" % (brightness)
    print(msg)
Exemplo n.º 2
0
import time
import line_follower_module

REFERENCES = [359, 352, 342, 316, 356]

forward_speed = 70
turning_speed = 60

max_off_track_count = 1  # off track count
max_trick_count = 1  # tolerant tricked count

my_pismart = PiSmart()
tts = TTS()
stt = STT('command', dictionary_update=False)
led = LED()
lf = line_follower_module.Line_Follower(references=REFERENCES)

my_pismart.motor_switch(1)
my_pismart.speaker_switch(1)

left_motor = Motor('MotorB', forward=0)
right_motor = Motor('MotorA', forward=1)
left_motor.stop()
right_motor.stop()

my_pismart.power_type = '2S'
my_pismart.speaker_volume = 3
my_pismart.capture_volume = 100

Exemplo n.º 3
0
#!/usr/bin/env python
'''
**********************************************************************
* Filename    : led_test.py
* Description : led test
* Author      : Dream
* E-mail      : [email protected]
* Website     : www.sunfounder.com
* Update      : Dream    2016-07-28 New version
*               Cavon    2016-08-23 Update set debug
**********************************************************************
'''
from pismart.led import LED
import time

leds = LED()
leds.DEBUG = 'debug'

LED_MAX = 100
LED_MIN = 10


def setup():
    print "|=====================================================|"
    print "|                   LED Ring test                     |"
    print "|-----------------------------------------------------|"
    print "|                                                     |"
    print "|              Breath Blue leds breath                |"
    print "|                                                     |"
    print "|                                           SunFounder|"
    print "|=====================================================|"
Exemplo n.º 4
0
def ledCallback(light):
    leds = LED()
    leds.brightness = light.data
Exemplo n.º 5
0
def led_off():
    led = LED()
    led.off()
    msg = "[PiSmart] Set LED off"
    print(msg)
Exemplo n.º 6
0
from pismart.led import LED
import time

blue_leds = LED(8)
red_leds = LED(9)

LED_MAX = 100
LED_MIN = 10


def main():
    while True:
        for x in xrange(1, 3):
            for x in xrange(LED_MIN, LED_MAX, 5):
                blue_leds.brightness = x
                time.sleep(0.003)
            for x in xrange(LED_MAX, LED_MIN, -5):
                blue_leds.brightness = x
                time.sleep(0.005)
        blue_leds.off()

        for x in xrange(1, 3):
            for x in xrange(LED_MIN, LED_MAX, 5):
                red_leds.brightness = x
                time.sleep(0.003)
            for x in xrange(LED_MAX, LED_MIN, -5):
                red_leds.brightness = x
                time.sleep(0.005)
        red_leds.off()