StevenM Posted March 1, 2020 Report Share Posted March 1, 2020 (edited) In the documentation the last example it opens a serial connection and sends a command. import time ECig.Track('Last Puff Energy') motor = Serial.Open('COM10', 9600) motor.WriteLine('P1: 2047') time.sleep(1) ECig['Power Set'] = 20; ECig.Puff(5) time.sleep(5) time.sleep(1) motor.WriteLine('P1: -2047') energy = ECig['Last Puff Energy'] ECig.StopTracking('Last Puff Energy') UI.Message('The last puff energy was {0} milliwatt-hours.'.format(energy)) Using some interspection I find that WriteLine isn't an available command, but Write is. The problem that I am finding with write is that .NET is expecting an Array[Byte], which I do not believe there is a way to convert to in python. motor = Serial.Open('COM4', 9600) s = u"P=50 W" b = bytearray() b.extend(s) motor.Write( b ,0,6) The only thing I am trying to do is be able to turn on and off charging on the board. If there is an easy way that works without open a serial port? Edited March 1, 2020 by StevenM Link to comment Share on other sites More sharing options...
VapingBad Posted March 1, 2020 Report Share Posted March 1, 2020 ECig['USB Current'] = 0.0 for boards that have an inbuilt charger 1 Link to comment Share on other sites More sharing options...
StevenM Posted March 1, 2020 Author Report Share Posted March 1, 2020 Awesome thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now