#id refGoExtensionExampleTTandTV.py 2024-09-27 oh # Fullmo MovingCap CODE - micropython example. # original file name: refGoExtensionExampleTTandTV.py # requires turnTRACK firmware v50.00.05.05_RE higher # This example shows how to mimic the original XENAX protocol commands # TT (Tell Temperature) and TV (Tell Velocity) # TIP: This code is for demonstration purposes. For practical applications, # calling the text-based "refgo" interface 10 times per milliseconds is a waste # of CPU time, but it demonstrates how fast MovingCap can run micropython code, # even if it includes string processing. import sys import mccom import mcdrive as mc mccom.open("refgo", 1) cmd = "" while (1): cmd = mccom.read(0, 0) if cmd is not None: if (cmd == "TT"): # Tell Temperature - return value of Movingcap-specific temperature object mccom.write(0, 0, "TT\r\n" + str(mc.ReadObject(0x3401, 0x0a)) + "\r\n") elif (cmd == "TV"): # Tell Velocity - return value of DS402 standard object "Velocity actual value" mccom.write(0, 0, "TV\r\n" + str(mc.ReadObject(0x606c, 0x0)) + "\r\n") # always finish with prompt ret = mccom.write(0, 0, ">")