Hi everyone,
In my experiment, I would like to have something like this.
If I click on a rating scale 0 tick mark, the solenoid valve will turn on and off until I click on another tick mark. If I click on a rating scale 1 tick mark, another solenoid valve will turn on and off until I click on the first tick mark. This operation will tack place till pre-defined count down timer reaches to 0.
I am having trouble with the mouse click. How can I use mouse.getPressed () function? I do not know what is the return of this function, so I am not able to use while loop with == or != operator. The document says ‘Returns a 3-item list indicating whether or not buttons 0,1,2 are currently pressed.’ I do not have any idea what does that means.
timer = core.CountdownTimer (myTimer)
while (timer.getTime() > 0):
myRatingScale12.draw()
instruction1.draw()
win.flip()
rating12 = myRatingScale12.getRating()
if rating12 == 0:
Here I would like to have while loop which runs until the mouse click
command = arduino.write(struct.pack(u'>H',257))
time.sleep (3)
command = arduino.write(struct.pack(u'>H',256))
myRatingScale12.reset()
elif rating12 == 1:
Here I would like to have while loop which runs until the mouse click
command = arduino.write(struct.pack(u'>H',4097))
time.sleep (3)
command = arduino.write(struct.pack(u'>H',4096))
myRatingScale12.reset()