Documentos de Académico
Documentos de Profesional
Documentos de Cultura
● Alumno:
1. Alan Alejandro Luna Gonzalez (18011658)
Arduino-Sensor-WiFi-ESP8266-Base de Datos.
Aplicaciones IOT
Alumno: Alan Alejandro Luna Gonzalez
long int t0 = 0;
long int t1 = 0;
//-------------------------------------------------
void setup()
{
Serial.begin(115200);
pinMode(13,OUTPUT);
}
//-------------------------------------------------
//-------------------------------------------------
//-------------------------------------------------
if ( debug )
{
Serial.print("Bytes del enviados: ");
Serial.println( contador );
}
}
//-------------------------------------------------
void loop()
{
t1 = millis();
if ( t1 > ( t0 + 1000 ) )
{
t0 = millis();
contadorTiempo++;
statusLED = !statusLED;
if ( statusLED )
{
digitalWrite(13,HIGH);
}
else
{
digitalWrite(13,LOW);
};
if ( statusLED )
{
digitalWrite(13,HIGH);
}
else
{
digitalWrite(13,LOW);
}
if ( debug )
{
Serial.print("Faltan :");
Serial.print( conexionTiempo - contadorTiempo );
Serial.println(" s");
}
char temporal[ 50 ];
} // if contador
} // if t1
} // loop
Código del servidor .php
<?php
/*
Practica Arduino-Sensor-Wifi-Base de datos
*/
?>
<?php
date_default_timezone_set('America/Mexico_City');
setlocal(LC_ALL,”es_ES”);
$quienB = $current_user->user_firstname;
$postdata = file_get_contents("php://input");
$obj = json_decode($postdata);
$pass = $obj->{'key'};
if($pass == 'x9xyLx56v9G7b3WC')
{
$fecha = new DateTime();
$fechaString = $fecha->format('Y-m-d H:i:s');
$fechaNumero = $fecha->getTimestamp();
$nombre = $obj->{'var'};
$dato = $obj->{'datoP'};
$dato2 = $obj->{'datoR'};
$dato3 = $obj->{'datoE'};
}
else
{
echo "{Nooooo OK}-{$pass}-{$dato}-{$fechaString2}-";
}
?>
Base de datos
Fritzing