Mixiaoxiao / Arduino-HomeKit-ESP8266

Native Apple HomeKit accessory implementation for the ESP8266 Arduino core.
MIT License
1.48k stars 278 forks source link

Implement temperature, humidity and 2 switches and oled 0.96 to monitor the sensors. #244

Open KaitoKK1412 opened 5 months ago

KaitoKK1412 commented 5 months ago

Can anyone help me to add two switches and an oled 0.96" so that it shows the temp and humidity in the first sample temperature, humidity. I am new to coding and want to learn new things. I would be thankful if anyone can help me.

stuntstein commented 3 months ago

Just the other day I made this little project https://github.com/stuntstein/Arduino_homekit_temp-humi-sensor

jockethebastard commented 3 months ago

Just the other day I made this little project https://github.com/stuntstein/Arduino_homekit_temp-humi-sensor

Cool! I’ll have to check it out, since I can’t get the temp working with any other code, and I’ve tried so many different versions. I also have an oled display never used.

stuntstein commented 3 months ago

IMG_1986

jockethebastard commented 3 months ago

Looks awesome! I guess it’s compatible with smaller oled screen, by adjusting the pixels right?

stuntstein commented 3 months ago

This is one of the smallest, but yes you can change the resolution:

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

You would also have to adapt the x,y offset when printing your text

  display.setCursor(0, 12);
  sprintf(s,"Tmp: %5.1fC", temp);
  display.print(s);