Letters Ino
Letters Ino
***********************************************************************************
**************************************
DEVELOPED BY: ARTUR FERREIRA MOREIRA
DATE: MAY, 13 OF 2017
EMAIL: [email protected]
WEBPAGE: http://daedalusstone.com/
INSTAGRAM: https://www.instagram.com/artur31415/
GOOGLEPLAY: https://play.google.com/store/apps/developer?id=Synapse
YOUTUBE: https://www.youtube.com/channel/UC6blOB30re0J-Oiksqaob1g/videos
GITHUB: https://github.com/artur31415
TWITTER: https://twitter.com/artur31415
LINKEDIN: https://www.linkedin.com/in/artur31415
///////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////
[ENG-USA]
This library was developed to work with the Android app "Controllium", with
which,
you can control your ESP8266 projects using your Android device.
Through the library you can attach any of the UI elements to the Arduino
hardware pins
accordingly to theirs functionalities.
You can use widgets to send and receive data from the ESP8266 using you
Android Device.
Look at the examples to understand how the library works.
Have fun!
[PT-BR]
Esta biblioteca foi desenvolvida para trabalhar com o aplicativo Android
"Controllium", com o qual,
Você pode controlar seus projetos de ESP8266 usando seu dispositivo Android.
Através da biblioteca você pode anexar qualquer um dos elementos UI para os
pinos de hardware arduino
De acordo com s uas funcionalidades.
Voce pode usar widgets para enviar e receber dados do ESP8266 usando o seu
dispositivo Android.
Veja os exemplos para entender como funciona a biblioteca.
Divirta-se!
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////
// Letters
//
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////
[ENG-USA]
In this example the letter buttons, that are on the Controllium android app,
are used on the ESP8266 to set its pins
states to the buttons states.
[PT-BR]
Neste exemplo os botões de letras, que estão no aplicativo android Controllium,
são usados na ESP8266 para definir
os estados de seus pinos de acordo com os estados dos botões.
***********************************************************************************
***************************************/
#include <Controllium.h>
#include <ESP8266WiFi.h>
//Controllium object
Controllium controllium("ESP_Letters");//Name of this device, if you have more than
one connected, provide a different name to each
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////
//// UTILS FUNCTIONS BEGIN
/////
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////
digitalWrite(pin, LOW);
delay(100);
}
//Setup Soft AP
void setupAP()
{
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
randomSeed(analogRead(A0) + analogRead(A0));
sprintf(SOFT_AP_SSID, "%s_%04d", SOFT_AP_SSID, random(1023));
WiFi.softAP(SOFT_AP_SSID, SOFT_AP_PASS, 6);
}
Serial.println(ROUTER_SSID);
int tries=0;
Serial.println();
return true;
}
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////
//// UTILS FUNCTIONS BEGIN
/////
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////
void setup()
{
//Init the serial for debug
Serial.begin(115200);
Serial.println("Soft AP On!");
Serial.print("\nSSID = ");
Serial.println(SOFT_AP_SSID);
Serial.print("PASS = ");
Serial.println(SOFT_AP_PASS);
//Begin server
Serial.print("\nUdp server started at port ");
Serial.println(UDP_DEFAULT_PORT);
controllium.BeginUdpServer(UDP_DEFAULT_PORT);
controllium.AddDevice(letterA);
controllium.AddDevice(letterB);
controllium.AddDevice(letterC);
controllium.AddDevice(letterD);
void loop()
{
//Just a blinking led to show that the device is alive
if(millis() - ledBlinkLastTime > 2000)
{
ledBlinkLastTime = millis();
blink(D[3]);
}
//LETTERS TO PINS
float letterAValue = (float)controllium.GetDevice("LETTER_A_0")-
>GetDoubleValue();
float letterBValue = (float)controllium.GetDevice("LETTER_B_0")-
>GetDoubleValue();
float letterCValue = (float)controllium.GetDevice("LETTER_C_0")-
>GetDoubleValue();
float letterDValue = (float)controllium.GetDevice("LETTER_D_0")-
>GetDoubleValue();
if(letterAValue >= 0)
digitalWrite(D[4], (int)letterAValue);
if(letterBValue >= 0)
digitalWrite(D[5], (int)letterBValue);
if(letterCValue >= 0)
digitalWrite(D[6], (int)letterCValue);
if(letterDValue >= 0)
digitalWrite(D[7], (int)letterDValue);
}
}