![]() grid ( row = 2, column = 2 ) #good luck ledrgb. Button #just a few buttons btn1 = Button ( ledrgb, text = "Rosu", bg = "red", fg = "white", command = led_rosu ) btn2 = Button ( ledrgb, text = "Verde", bg = "red", fg = "white", command = led_verde ) btn3 = Button ( ledrgb, text = "Albastru", bg = "red", fg = "white", command = led_albas ) btn4 = Button ( ledrgb, text = "Alb", command = led_alb ) btn5 = Button ( ledrgb, text = "Violet", command = led_vio ) btn6 = Button ( ledrgb, text = "Random", command = led_random ) btn7 = Button ( ledrgb, text = "Exit", command = close_window ). enter code here from tkinter import import serial import time ArduinoUnoSerial serial.Serial ('COM3',9600) print (ArduinoUnoSerial.readline ()) Create Serial port object called ArduinoUnoSerialData time.sleep (2) wait for 2 secounds for the communication to get established read the. showinfo ( "X", "!!! Bun venit !!!" ) #exit function def close_window (): arduinoData. Turning LED ON/OFF while using Tkinter using Arduino. configure ( background = "grey" ) tkinter. To keep the tradition alive (of having a. ![]() title ( "Arduino RGB Led Control" ) ledrgb. While working with the Firmata protocol in the previous chapter, we already blinked an LED on the Arduino board. write ( b '4' ) def led_random (): arduinoData. write ( b '3' ) def led_vio (): arduinoData. write ( b '2' ) def led_alb (): arduinoData. write ( b '1' ) def led_albas (): arduinoData. ![]() write ( b '0' ) def led_verde (): arduinoData. Serial ( 'com7', 9600 ) def led_rosu (): arduinoData. # hope you enjoy it and Merry X-mas :) import serial import tkinter import ssagebox arduinoData = serial.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |