About Arduino Web Voice
please check this link:https://youtu.be/SYKfhm14qEE
important notes :
change the arduino ip in arduino code to your home network
in the application type http://youripaddress
arduino code:
#include
#include
byte mac[] = { 0xDE,0xAD,0xBE,0xEF,0xFE,0xED };
byte ip[] = {192,168,8,177}; //change the ip address to your home network//
EthernetServer server(80);
int led2 = 2; // Channel 1
int led3 = 3; // Channel 2
int led4 = 4; // Channel 3
int led5 = 5; // Channel 4
int pinout2 = LOW;
int pinout3 = LOW;
int pinout4 = LOW;
int pinout5 = LOW;
void setup() {
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);
digitalWrite(led4, HIGH);
digitalWrite(led5, HIGH);
Ethernet.begin(mac, ip);
server.begin();
}
// the loop routine runs over and over again forever:
void loop() {
read_data(); // Reads incoming client requests.
if (pinout2 == LOW) // Turn off the output.
{
digitalWrite(led2, HIGH); // turn the LED off by making the voltage HIGH
}
if (pinout2 == HIGH) // Turn on the output.
{
digitalWrite(led2, LOW); // turn the LED on by making the voltage LOW
}
if (pinout3 == LOW) // Turn off the output.
{
digitalWrite(led3, HIGH); // turn the LED off by making the voltage HIGH
}
if (pinout3 == HIGH) // Turn on the output.
{
digitalWrite(led3, LOW); // turn the LED on by making the voltage LOW
}
if (pinout4 == LOW) // Turn off the output.
{
digitalWrite(led4, HIGH); // turn the LED off by making the voltage HIGH
}
if (pinout4 == HIGH) // Turn on the output.
{
digitalWrite(led4, LOW); // turn the LED on by making the voltage LOW
}
if (pinout5 == LOW) // Turn off the output.
{
digitalWrite(led5, HIGH); // turn the LED off by making the voltage LOW
}
if (pinout5 == HIGH) // Turn on the output.
{
digitalWrite(led5, LOW); // turn the LED off by making the voltage LOW
}
}
void read_data ()
{
// Check for a connection.
EthernetClient client = server.available();
if (client) {
boolean newLine = true;
String line = "";
while (client.connected() && client.available()) {
char c = client.read();
if (c == 'n' && newLine) {
// Send http header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();
}
if (c == 'n') {
//New line
newLine = true;
determine_input_tag(line);
line = "";
}
else if (c != 'r') {
//
newLine = false;
line += c;
}
}
determine_input_tag(line);
delay(1);
// Terminate the connection.
client.stop();
}
}
// The "determine_input_tag" routine modifies the required
// variable depending on the client request.
void determine_input_tag(String line)
{
if (line.startsWith("tag", 0)) {
String android = line.substring(4, line.length());
if (android == "A")
pinout2 = LOW;
if (android == "B")
pinout2 = HIGH;
if (android == "C")
pinout3 = LOW;
if (android == "D")
pinout3 = HIGH;
if (android == "E")
pinout4 = LOW;
if (android == "F")
pinout4 = HIGH;
if (android == "G")
pinout5 = LOW;
if (android == "H")
pinout5 = HIGH;
if (android == "I")
{
pinout2 = LOW;
pinout3 = LOW;
pinout4 = LOW;
pinout5 = LOW;
}
if (android == "J")
{
pinout2 = HIGH;
pinout3 = HIGH;
pinout4 = HIGH;
pinout5 = HIGH;
}
}
}