IMPORTANT: Install the following sketch on your Arduino to use AutoArduino: https://github.com/joaomgcd/AutoArduino-Sketch/blob/master/pins.ino
STEP 1 - CONNECT BUTTON TO ARDUINO
- Connect Button to breadboard
- Connect negative end of the Button to GND on the Arduino
- Connect positive end of the Button to Pin 3 on the Arduino
STEP 2 - CREATE TASK AND CONNECT
- Make sure to follow the instructions here to add your Arduino to AutoArduino
- Add an AutoArduino Connect action and make sure Connect is checked
- Select your Arduino from the device list
STEP 3 - READ BUTTON STATE
You may notice that a variable called %pin3d will be created resulting from this action. This will represent the state of Pin 3
- Add an AutoArduino Read Pins action
- Touch Digital and select Pin 3 (which was the pin you connected the button to on your Arduino)
STEP 4 - SHOW STATE
- Add a Flash action
- Set the text to %pin3d
STEP 5 - DISCONNECT
You don't need to disconnect every time you write pins with AutoArduino, but it is good practice if you don't intend to use AutoArduino again in the near future. Leaving a connection open will create a process for AutoArduino in the background and will make actions faster
- Add an AutoArduino Connect action and make sure Connect is NOT checked
- Return to Tasker
STEP 6 - TEST
If you now run the task while not pressing the button you should see that the state is 1. If you run it while pressing the button the state will be 0