... | ... | @@ -42,7 +42,7 @@ After activating the touch sensor the robot starts reversing. It stays in revers |
|
|
|
|
|
If the touch sensor is pressed, the takeControl() method returns a value of 100 (see fig 3) which initiates the prioritised action() behavior. Once initiated, the boolean value ‘active’ is set to true and the priority value is set to 50. This means that if the touch sensor is pressed while the action() is still running the method will start over due to the higher priority.
|
|
|
|
|
|
´´´
|
|
|
```
|
|
|
public int takeControl()
|
|
|
{
|
|
|
if (touch.isPressed() || distance < 25)
|
... | ... | @@ -52,5 +52,5 @@ If the touch sensor is pressed, the takeControl() method returns a value of 100 |
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
´´´
|
|
|
```
|
|
|
##### Fig. 3: takeControl() method. Shows how different values are returned according to sensor values and if the methods is ‘active’. |
|
|
\ No newline at end of file |