Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Homepage
Here is the Python code for the PyQt Gui...¶
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import sys
import serial
def printNumber(number):
print number
ser = serial.Serial('COM5',9600)
#state which port the KL46Z is connected to and the baud rate
ser.write(unichr(number).encode())
#encode number from slider and send the encoded character to KL46Z
if __name__=="__main__":
app=QApplication(sys.argv)
slider=QSlider(Qt.Horizontal)
slider.setRange(1,127)
slider.setFixedWidth(400)
slider.setSliderPosition(64)
#create a QApplication and QSlider
QObject.connect(slider,SIGNAL("valueChanged(int)"),printNumber)
#call the printNumber funciton each time the value on the slider changes
slider.show()
#start the loop
sys.exit(app.exec_())