Arduino Scripting Example. This example shows how to make a scriptable app that blinks a LED on the Arduino. It is similar to the Arduino LED On/Off TCP Example, but this app has a user interface for scripting the Arduino.
The Arduino sketch used in this example is the same as in the Arduino LED On/Off TCP Example, and files arduinotcp.js, arduinowifi.ino and arduinoethernet.ino are also the same. For clarity, the instructions from the Arduino LED On/Off Example are repeated below.
You can browse the source code for this example at the Evothings GitHub repository
The file arduinowifi.ino contains the Arduino WiFi server that listens for commands from the app.
The file arduinoethernet.ino contains the Arduino Ethernet server that listens for commands from the app.
Default pin values run from 0 through 9, as pin 10-13 is reserved for the WiFi shield and not available. If you want to control other pins, feel free to modify the code to suit your needs.
This example runs in Evothings Viewer on Android or iOS.
You need to run this example in Evothings Viewer. Alternatively, you can build a Cordova application if you wish to distribute the app. You then need to include the Cordova plugin org.chromium.socket. Read more in the documentation of the Evothings Viewer.
For the Arduino setup, you need:
Here is the sketch:
Here is a photo of a board configured to work with this example. Note that output pin 2 is used (it may look like pin 3 in the photo).
Follow these steps to get started with this example: