Esp8266 ile Arduino ve Android Bağlantısı
  • Merhaba arkadaşlar,

    Elimde esp8266 modülü bulunuyor. Bu modül ile arduino ve android arasında bağlantıyı bir türlü sağlayamadım yardımcı olabilirseniz sevinirim. En son firebase üzerinden bağlanmayı denedim fakat esp8266 yı yüklerken sürekli " In file included from C:\Program Files (x86)\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFiSTA.h:28:0,

    from C:\Program Files (x86)\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFi.h:34,

    from C:\Users\EA\Desktop\esp8266firebase\esp8266firebase.ino:1:

    C:\Program Files (x86)\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFiGeneric.h:27:22: fatal error: functional: No such file or directory

    #include functional " hatası almaktayım. Kodlar;

    #include "ESP8266WiFi.h"
    #include "FirebaseArduino.h"



    int leds[3] = {D8, D9, D10};
    int states[3] = {LOW, LOW, LOW};
    int totalDevices = 3;


    #define firebaseURl "--------------------"
    #define authCode "--------------------"

    #define wifiName "--------------------"
    #define wifiPass "--------------------"


    String chipId = "--------------------";


    void setupFirebase() {

    Firebase.begin(firebaseURl, authCode);
    }

    void setupWifi() {

    WiFi.begin(wifiName, wifiPass);

    Serial.println("Hey i 'm connecting...");

    while (WiFi.status() != WL_CONNECTED) {

    Serial.println(".");
    delay(500);
    }

    Serial.println();
    Serial.println("I 'm connected and my IP address: ");
    Serial.println(WiFi.localIP());
    }


    void setup() {

    Serial.begin(9600);

    setupWifi();
    setupFirebase();

    setupPinsMode();

    }



    void getData() {

    String path = chipId + "/states";
    FirebaseObject object = Firebase.get(path);

    bool led1 = object.getBool("001");
    bool led2 = object.getBool("002");
    bool led3 = object.getBool("003");

    Serial.println("Led 1: ");
    Serial.println(led1);

    //
    Serial.println();
    Serial.println("Led 2: ");
    Serial.println(led2);

    //
    Serial.println();
    Serial.println("Led 3: ");
    Serial.println(led3);


    // write output high or low to turn on or off led
    digitalWrite(leds[0], led1);

    digitalWrite(leds[1], led2);

    digitalWrite(leds[2], led3);

    }
    void loop() {


    getData();


    }

    void setupPinsMode() {

    // setup Pin mode as output.


    for (int i; i < totalDevices; i++) {

    Serial.printf("Setup Output for pin %d", leds[i]);
    pinMode(leds[i], OUTPUT);
    }
    }

  • Aynı problemi bende yaşıyorum, farklı olarak sadece database üzerinden tanımladığım linke GET atamıyorum. Rez.
  • Kullandığım kodlar ise şöyle ;

    #include "WiFiEsp.h"

    // Emulate Serial1 on pins 6/7 if not present
    #ifndef HAVE_HWSERIAL1
    #include "SoftwareSerial.h"
    SoftwareSerial Serial1(2, 3); // RX, TX
    #endif

    char ssid[] = "----"; // your network SSID (name)
    char pass[] = "-----"; // your network password
    int status = WL_IDLE_STATUS; // the Wifi radio's status

    char server[] = "http://------------";

    // Initialize the Ethernet client object
    WiFiEspClient client;

    void setup()
    {
    // initialize serial for debugging
    Serial.begin(115200);
    // initialize serial for ESP module
    Serial1.begin(115200);
    // initialize ESP module
    WiFi.init(&Serial1);

    // check for the presence of the shield
    if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue
    while (true);
    }

    // attempt to connect to WiFi network
    while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network
    status = WiFi.begin(ssid, pass);
    }

    // you're connected now, so print out the data
    Serial.println("You're connected to the network");

    printWifiStatus();

    Serial.println();
    }

    void loop()
    {
    unsigned long starttime, stoptime, looptime;
    starttime = millis();
    senddata();
    stoptime = millis();
    looptime = stoptime - starttime;
    Serial.print("Run time :");
    Serial.println(looptime);
    // if there are incoming bytes available
    // from the server, read them and print them
    while (client.available() ) {
    // char c = client.read();
    // Serial.write(c);
    client.stop();
    }

    // // if the server's disconnected, stop the client
    // if (!client.connected()) {
    // Serial.println();
    // Serial.println("Disconnecting from server...");
    //
    // client.stop();
    //
    // // do nothing forevermore
    // while (true);
    // }
    }

    void senddata(){
    Serial.println("Starting connection to server...");
    // if you get a connection, report back via serial
    if (client.connect(server, 80)) {
    Serial.println("Connected to server");
    // Make a HTTP request
    client.println("GET /finishtask.php?id=6165 HTTP/1.1");
    client.println("Host: ------------");
    client.println("Connection: close");
    client.println();
    }
    }

    void printWifiStatus()
    {
    // print the SSID of the network you're attached to
    Serial.print("SSID: ");
    Serial.println(WiFi.SSID());

    // print your WiFi shield's IP address
    IPAddress ip = WiFi.localIP();
    Serial.print("IP Address: ");
    Serial.println(ip);

    // print the received signal strength
    long rssi = WiFi.RSSI();
    Serial.print("Signal strength (RSSI):");
    Serial.print(rssi);
    Serial.println(" dBm");
    }// - See more at: http://www.esp8266.com/viewtopic.php?f=6&t=14581#sthash.C7quMzHf.dpuf
  • once esp8266 yı standart uygulamalar ustunden bır deneyın o konular oturduktan ve esp yi tanıdıktan sonra gelişmiş uygulamaları test edın derım.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook
Açık kaynak kültürü gereği, çözdüğünüz problemlerin çözümlerini paylaşmayı lütfen unutmayın.