Under Arduino mode, the instruction blocks will be tranfer to Arduino C++ into Arduino IDe, and user could modify code in Arduino IDe, and then upload the code into Robot. In that case, the Robot is running offline and it can not interact with Scratch’s stage.
In this example, we want to turn on an LED whenever you press tactile switch 1 of evive. The logic is similar to the previous example, you just have to change the hat block to Arduino Program and boolean block.
We will be continuously checking if the tactile switch is pressed. This will be either true or false. Now, we will use conditional statements, which will take decision to execute particular statements according to the result. In our case, this is if-else, where if the result is true, LED will be ON, else LED will be OFF.
The next step is to express your logic in a way so that the computer can understand it.
Right click on the hat block and click upload to Arduino. Upload the code and you are done.