mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-10 01:05:42 +00:00
feature: added showOnDisplay
This commit is contained in:
parent
52caa7aa22
commit
ad76236ea0
1 changed files with 11 additions and 1 deletions
|
@ -127,6 +127,11 @@ class hardwareInterface():
|
||||||
#self.addToTrace("RX data ok " + s)
|
#self.addToTrace("RX data ok " + s)
|
||||||
self.rxbuffer = self.rxbuffer[x+3:] # consume the receive buffer entry
|
self.rxbuffer = self.rxbuffer[x+3:] # consume the receive buffer entry
|
||||||
|
|
||||||
|
def showOnDisplay(self, s1, s2, s3):
|
||||||
|
# show the given string s on the display which is connected to the serial port
|
||||||
|
s = "lc" + s1 + "\n" + "lc" + s2 + "\n" + "lc" + s3 + "\n"
|
||||||
|
self.ser.write(bytes(s, "utf-8"))
|
||||||
|
|
||||||
def mainfunction(self):
|
def mainfunction(self):
|
||||||
if (self.simulatedSoc<100):
|
if (self.simulatedSoc<100):
|
||||||
if ((self.outvalue & 2)!=0):
|
if ((self.outvalue & 2)!=0):
|
||||||
|
@ -158,6 +163,8 @@ if __name__ == "__main__":
|
||||||
hw = hardwareInterface(myPrintfunction)
|
hw = hardwareInterface(myPrintfunction)
|
||||||
for i in range(0, 350):
|
for i in range(0, 350):
|
||||||
hw.mainfunction()
|
hw.mainfunction()
|
||||||
|
if (i==20):
|
||||||
|
hw.showOnDisplay("Hello", "A DEMO", "321.0V")
|
||||||
if (i==50):
|
if (i==50):
|
||||||
hw.setStateC()
|
hw.setStateC()
|
||||||
if (i==100):
|
if (i==100):
|
||||||
|
@ -165,6 +172,7 @@ if __name__ == "__main__":
|
||||||
if (i==150):
|
if (i==150):
|
||||||
hw.setStateC()
|
hw.setStateC()
|
||||||
hw.setPowerRelayOn()
|
hw.setPowerRelayOn()
|
||||||
|
hw.showOnDisplay("", "..middle..", "")
|
||||||
if (i==200):
|
if (i==200):
|
||||||
hw.setStateB()
|
hw.setStateB()
|
||||||
hw.setPowerRelayOff()
|
hw.setPowerRelayOff()
|
||||||
|
@ -172,6 +180,8 @@ if __name__ == "__main__":
|
||||||
hw.setRelay2On()
|
hw.setRelay2On()
|
||||||
if (i==300):
|
if (i==300):
|
||||||
hw.setRelay2Off()
|
hw.setRelay2Off()
|
||||||
|
if (i==320):
|
||||||
|
hw.showOnDisplay("This", "...is...", "DONE :-)")
|
||||||
sleep(0.03)
|
sleep(0.03)
|
||||||
hw.close()
|
hw.close()
|
||||||
print("finished.")
|
print("finished.")
|
Loading…
Reference in a new issue