5-way navigational key
evive has inbuilt 5-way navigational (or Joystick), which is used to navigate in evive menu based system. The navigational key has 4 directions: left, right, up and down. This information is provided by the analog pin A11.
Getting Joystick input from Arduino IDE
The table provides you with the corresponding values for directions:
The sample code is provided below:
The center switch is connected to the digital pin 19 in active or high mode. This means that if the switch is pressed, then pin 19 is high, otherwise, the pin is LOW.
Getting Joystick Input in Scratch
You can get the state of evive Joystick using Navigation key is in () direction. This block can be found under the Robots palette in the extension evive Inbuilt tools. evive has a 5-way navigation key, 4 of them are for up, down, right and left direction. This block checks if the navigation key is in one of the four particular directions. The direction for which you wish to check is your choice and can be chosen from the drop down on the block.
- In this script the sprite moves up, down, left and right according using the navigation key and rotate it 360 degrees if the navigation switch is pressed in z direction.