Apple iMac cannot enter new topic

This topic contains 2 replies, has 1 voice, and was last updated by  hoofdbaas 1 week, 4 days ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #2229 Reply

    hoofdbaas
    Participant

    usage of textbox for topic cannot be used, all entered text is mixed op the top line

    #2230 Reply

    hoofdbaas
    Participant

    After posting 1 line of text I succeeded anyhow????

    This is my first attempt to control my Hue lights with an ESP8266

    #include <Arduino.h>
    #include <U8x8lib.h> // OLED display to display some key values
    #include <dummy.h>

    U8X8_SH1106_128X64_NONAME_HW_I2C u8x8(/* reset=*/ U8X8_PIN_NONE);
    #include <RTClib.h>
    #include <WiFiClient.h>
    #include <ESP8266WiFi.h>
    //#include<WiFi.h>
    #include <ESPHue.h>
    #include <Wire.h>
    #include <BH1750.h>

    const char* ssid = “YOUR SSID”;
    const char* password = “YOUR PW”;
    char nummer[20];
    bool vlag = false ;
    bool lampAan = true;
    unsigned long wacht;
    #define vertraging 30000
    WiFiClient client;
    ESPHue myHue = ESPHue(client, “YOUR HUE USERNAME”, “192.168.178.12”, 80);
    BH1750 lightMeter(0x23);
    RTC_DS3231 rtc;

    void setup()
    {
    Serial.begin(115200);
    Serial.println();
    Serial.print(“Connecting to “);
    Serial.println(ssid);
    //WiFi.hostname(“Verlichting”);
    WiFi.begin(ssid, password);
    u8x8.begin();
    u8x8.setPowerSave(0);
    while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(“.”);
    }

    Serial.println(“”);
    Serial.println(“WiFi connected”);
    Serial.println(“IP address: “);
    Serial.println(WiFi.localIP());

    Wire.begin(D3, D5);
    if (lightMeter.begin(BH1750::CONTINUOUS_HIGH_RES_MODE)) {
    Serial.println(F(“Lichtsensor actief!”));
    }
    else
    Serial.println(F(“Lichtsensor fout!!!”));
    Serial.println(“Klok opgestart!”);
    //clock.begin();
    u8x8.begin();
    u8x8.setPowerSave(0);
    wachten();
    }

    void loop()
    {
    int teller;
    char test[15], delta[5];
    char tijd[30];
    float lux = lightMeter.readLightLevel();
    unsigned long interval = millis() – wacht;

    u8x8.setFlipMode(1);
    u8x8.setFont(u8x8_font_chroma48medium8_r);
    u8x8.drawString(0, 0, (WiFi.localIP().toString().c_str()));
    sprintf(test, “%d %s “, int(round(lux)), “lux”);
    u8x8.drawString(0, 2, test);

    DateTime now = rtc.now();
    teller = now.dayOfTheWeek();
    if (teller == 2 || teller == 4 || teller == 5)
    vlag = true; // geselecteerde lampen aan op di,do,vr
    else
    vlag = false;

    sprintf(tijd, “%02d:%02d:%02d”, now.hour(), now.minute(), now.second());
    sprintf(delta, “%d ” , (vertraging – interval) / 1000);
    u8x8.drawString(0, 3, tijd);
    u8x8.drawString(0, 4, ” “);
    u8x8.drawString(0, 4, (delta));
    if (interval > vertraging )
    {
    if (lux < 100 && now.hour() >= 9 && now.hour() <= 23)
    lampenAan();

    if (lux < 100 && now.hour() >= 7 && now.hour() <= 9 && vlag == true) // di,do,vr ochtend licht aan
    winter();

    if (lux > 100)
    lampenUit();

    }
    if (interval > vertraging)
    wachten();
    delay(980);
    }

    void wachten()
    {
    wacht = millis();
    }

    void lampenAan()
    {
    for ( int teller = 5; teller <= 9; teller++)
    myHue.setLightPower(teller, myHue.ON);
    // lampAan = true;
    }

    void lampenUit()
    {
    for ( int teller = 5; teller <= 9; teller++)
    myHue.setLightPower(teller, myHue.OFF); // alle lampen uit
    // lampAan = false;
    }
    void winter()
    {
    myHue.setLightPower(6, myHue.ON);
    myHue.setLightPower(9, myHue.ON);
    myHue.setLightPower(8, myHue.ON);
    myHue.setLightPower(15, myHue.ON);
    }

    #2231 Reply

    hoofdbaas
    Participant

    It’s a bit of a mess, but cannot edit or delete this post.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Apple iMac cannot enter new topic
Your information: