Raspberry Pi PiLite Countdown Python Example

Опубликовано: 07 Август 2013
на канале: David Rogers
1,633
6

First bit of messing around with Python on the Raspberry Pi with the excellent PiLite from Ciseco (http://shop.ciseco.co.uk/), but something that I found out about through Kickstarter http://www.kickstarter.com/projects/c...

The LEDs themselves are bright, and I could have done with a filter on my camera.

I have found the messing around with Python a bit of a pain to begin with but it has been easy to get something up and running quickly.
You do need some careful use of the sleep function especially when loading graphics as the baudrate is relatively low.

countdown.py

#!/usr/bin/env python

import serial, time
#import datetime
#datetime.datetime.now().time()

s= serial.Serial()
s.baudrate = 9600
s.timeout = 0
s.port = "/dev/ttyAMA0"

try:
s.open()
except serial.SerialException, e:
sys.stderr.write("could not open port &r: %s\n" % (port, e))
sys.exit(1)

s.write("$$$ALL,OFF\r")
time.sleep(0.5)
while True:
for i in range (0,10):
k = 10 - i
s.write("%d" %k)
time.sleep(1)
s.write("$$$F111111111100010001011101110000000000000000110000101001000011110
000000000000000111000001000000000111011000000100100001011111110\r")
time.sleep(5)
s.write("$$$ALL,OFF\r")


На этой странице сайта вы можете посмотреть видео онлайн Raspberry Pi PiLite Countdown Python Example длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь David Rogers 07 Август 2013, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 1,633 раз и оно понравилось 6 зрителям. Приятного просмотра!