# How to capture the change of 2 fix patches in the screen?

## Recommended Posts

Hi,

I would like to write a program to capture the change of TWO patches in the screen. I have the flow chart but do not know how to write the script. Can any experts here help me?

The problem and flow are as follows:

Problem:

Write a program to capture any change in color of TWO patches A and B in the screen. The size of each patch will be as small as 0.5cm x 0.5cm. Actually there are only two color status for each patch, A0 or A1, B0 or B1. And there will always be only three combinations of the two patches as shown in figure 1 to figure 3.

(e.g. The color of A0 is totally dark red, A1 is totally light red.)

Figure 1 . Figure 2

Figure 3

Flow:

1. Initialize 2 variables Xa , Xb to be zero,

2. Display the two variables Xa , Xb in the screen,

3. Define the co-ordinates and size of the two patches A and B,

4. Define the initial status of patches A and B as combination 1,

5. Capture the change of the two fix patches A and B in the screen every 1 second,

6. If change from combination 1 to combination 2, then

Xa = Xa + 1; Xb = 0;

7. If change from combination 2 back to combination 1, then

Xa = Xa; Xb = Xb; (no change in variables)

8. If change from combination 1 to combination 3, then

Xa = 0; Xb = Xb +1;

9. If change from combination 3 back to combination 1, then

Xa = Xa; Xb = Xb; (no change in variables)

10. If change from combination 2 to combination 3, then

Xa = 0; Xb = Xb +1;

11. If change from combination 3 to combination 2, then

Xa = Xa + 1; Xb = 0;

12. If Xa > 6 then play the musical file C:/a.wav,

13. If Xb > 6 then play the musical file C:/b.wav,

Edited by C1628

##### Share on other sites

Scan for the color on screen :S ?

-jaenster

##### Share on other sites

Scan for the color on screen :S ?

Actually each patch has only two color status, A0 or A1, B0 or B1.

Thank you.

## Create an account

Register a new account