RUVIDEO
Поделитесь видео 🙏

Arduino Python Serial Comm.(Read,Write) and Python GUI with Tkinter (ctrl. LEDs on/off w/ Buttons)

Arduino Python Serial Communication(Read,Write) and Python GUI with Tkinter (Controlling LEDs on/off with Buttons )

- Using Python2.7.10, pySerial2.7 and Tkinter8.5 , finally using a py2exe to convert python(py) file to exe file.

- How does it work

1. Program will read a Comport and Buadrate from a filename named \'config.txt\' where in same path of Program (python_serial_led.py(or python_serial_led.exe)).

2. When the program run in the first time,it will request the state of LEDs(on/off). Which button text and color will change according to the received data(state of LEDs).

3. Both buttons, when clicked, it will command an Arduino in order to turn on and off the LEDs (led1,led2).

4. When pressing the switch from the side of Arduino. Button text and color changes in the status of switch on(led on) and off(led off).
** This project use Python2.7.10, pySerial2.7 and Tkinter8.5
P.S. -Make exe file using py2exe and create icons for this program.
-Press Escape key for quit, F7 key for request state(on/off)
-Protect arduino reset,use Electrolyte Cap10-100uf( (+)--reset , (-) -- gnd )'''

วิธีการทำงาน
1.โปรแกรม อ่านค่าของ com port และ baudrate จาก ไฟล์ชื่อ config.txt ซึ่งอยู่ที่เดียวกับไฟล์โปรแกรม python_serial_led.py(หรือ python_serial_led.exe)

2.เมื่อเปิดโปรแกรมครั้งแรก จะทำการขอ สถานะของหลอดไฟ (0=off,1=on) ซึ่งจะทำให้ข้อความ สี ของปุ่มเปลี่ยนไปตามค่าที่รับมา

3.เมื่อปุ่มทั้งสองถูกคลิก จะส่งรหัสคำสั่งไปยัง Arduino เพื่อทำการเปิดปิดหลอดไฟ

4.เมื่อมีการกดสวิทย์ จากฝั่งของ Arduino จะทำให้หลอดไฟดับพร้อมกับ ส่งรหัสคำสั่งไปยัง serial buffer เพื่อให้ โปรแกรมทำการอ่านค่าที่รับมา และทำให้ ข้อความ สี ของปุ่มที่เกี่ยวข้องเปลี่ยนตาม

***โปรเจ็คนี้ใช้ Python2.7.10, pySerial2.7 และ Tkinter8.5
ป.ล. สุดท้ายจะทำการแปลง นามสกุล py เป็น exe ด้วย py2exe , ในโปรแกรมนี้จะใช้ ไอคอนที่สร้างมาเองเพื่อเป็นไอคอนของโปรแกรม
-กด คีย์ Esc จะออกจากโปรแกรม , กด F7 คีย์ เพื่อ ขอสถานะของหลอดไฟทั้งสอง
-เพื่อป้องกัน arudino ทำการ รีเซตตัวเอง ให้ใช้ คาปาซิเตอร์ แบบอีเลคโทรไลต์ 10-100uf (ขา + ไปยัง reset pin, ขา- ไปยัง gnd)

-Related files ,follow link for download : ino file, python_serial_led.py, pyserial-2.7.win32.exe, python-2.7.8.msi,
dist_python_serial_led_exe.rar
https://drive.google.com/open?id=0BzjoxIwEMrM-ZWRrX1lneVRVM00

Credit:
https://www.tutorialspoint.com/python/tk_text.htm //tutorail python
http://robotic-controls.com/learn/python-guis/tkinter-serial //to enable interface respond in tk mainloop
http://stackoverflow.com/questions/25753632/tkinter-how-to-use-after-method // explain After method of tkinter
http://stackoverflow.com/questions/20588417/how-to-change-font-and-size-of-buttons-and-frame-in-tkinter-using-python
http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/button.html //button font in tkinter
http://image.online-convert.com/convert-to-ico // convert image to ico
https://pypi.python.org/pypi/pyserial/2.7 //pyserial/2.7
https://www.python.org/downloads/release/python-2710/ //downloads/release/python-271
http://www.py2exe.org/old/ //py2exe
http://stackoverflow.com/questions/21848033/access-denied-using-py2exe
http://effbot.org/tkinterbook/pack.ht #patterns //tkinter pack , fill , expand
http://stackoverflow.com/questions/21073086/wait-on-arduino-auto-reset-using-pyserial //arduino-auto-reset-using-pyseria

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Arduino Python Serial Comm.(Read,Write) and Python GUI with Tkinter (ctrl. LEDs on/off w/ Buttons)», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.