Controll all GPIO inputs/outputs through OSC.
This code enables you to controll all GPIO through OSC. For example, you can blink LED with Max/MSP. You also can use this Max Patch ( https://github.com/fataris/ESP8266-OSC_Basic_Controller ) to control the module.
- Metro (Arduino Playground)
Each message requires MODULE_ID to identify the target module.
Set your WiFi's SSID and passphrase
char ssid[] = "SSID"; // your network SSID (name)
char pass[] = "PASS"; // your network password
Set host Address and port
IPAddress hostAddress(224, 0, 0, 1); // remote IP of your computer
const unsigned int hostPort = 56789; // remote port to receive OSC
Set incoming port
const unsigned int receivePort = 54321; // local port to listen to OSC packets
/gpio_mode "(int)MODULE_ID" "(int)GPIO_ID" "(bool)IN/OUT"
-
This messages changes pinMode()
-
0 = Input, 1 = Output.
-
GPIO_IDs :: 12, 13, 14
/digital_out "(int)MODULE_ID" "(int)GPIO_ID" "(float)val"
-
This message sets value of DigitaiWrite()
-
val : 0.0 ~ 1.0, which will be 0.0V ~ 3.3V
/analog_in "(int)MODULE_ID" "(float)val"
-
Analog input value comes with this message
-
Value range : 0.0 ~ 1.0
/digital_in "(int)MODULE_ID" "(int)val"
-
Digital input value comes with this message
-
Value : 0, 1
/active "(int)MODULE_ID" 1
-
This message comes every second to notice the module is acitve.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.