Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ESP8266WiFi.h>
- int te = 25;
- const char* ssid = ""; //tutaj wpisuje swoje dane wifi
- const char* haslo = "";
- const int port = 80;
- const char* host = "192.168.0.105";
- WiFiClient client;
- void setup() {
- Serial.begin(115200);
- delay (10);
- WiFi.begin(ssid, haslo);
- while (WiFi.status() != WL_CONNECTED) {
- delay (1000);
- Serial.println(".");
- }
- Serial.println("Połączono do: ");
- Serial.println(ssid);
- Serial.println("Adres IP: ");
- Serial.println(WiFi.localIP());
- }
- void loop() {
- if (client.connect(host, port) == true)
- {
- Serial.println("połączono z serwerem!");
- client.print("GET /test.php");
- client.print("temp=");
- client.print(te);
- Serial.println("Wysłano dane");
- }
- client.stop();
- Serial.println("Rozłączono z serwerem");
- delay(10000);
- }
- /* Plik PHP na raspberry o nazwie test.php
- <?php
- $te = $_GET['temp'];
- echo $te
- ?>
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement