in reply to Re^2: Tk Buttons
in thread Tk Buttons

And to further explain, the buttons, when pressed control the speed and direction of a motor connected to the laptop via a usb cable using the Win32::SerialPort module....that part works. What is happening when the direction button is pressed it gets faster in the forward direction and when pressed again it gets faster and faster...and when the reverse button is pressed the motor stops and proceeds to going in the reverse direction and each time that button is pressed it gets faster and faster....here is what is happening....if the forward button is pressed again....instead of starting at speed 0....it picks up where the last forward button press left off...lets say it stopped at 40 when we first pressed the reverse button....when the forward button is pressed again it goes to speed 50 instead of starting back at zero....same holds true if the reverse button was pressed again.

Replies are listed 'Best First'.
Re^4: Tk Buttons
by fishmonger (Chaplain) on Nov 14, 2015 at 14:47 UTC

    The info regarding the controlling of the motor and use of Win32::SerialPort is completely irrelevant to the problem you're asking about.

    As has already been mentioned, your posted code does not include anything that would change/rest the value. I will repeat the request that Athanasius made. Please post a short but complete script that demonstrates the problem you're having with the setting/resetting of the values so that we can run some tests. With that info we should be able to point out problem and solution. It would also be helpful if you would use proper code formatting so that your code is more readable.