12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #include "WiFi.h"
- #include <OneWire.h>
- #include <DS18B20.h>
- #include <TM1637Display.h>
-
- //const char* ssid = "Antenne 5G";
- //const char* password = "Un Truc Moins Chiant";
- const char* ssid = "Livebox-8DA0";
- const char* password = "C3F3EE221002051A31382FFAF7";
-
- #define CLK 18
- #define DIO 5
- #define ONE_WIRE_BUS 4
-
- OneWire oneWire(ONE_WIRE_BUS);
- DS18B20 sensor(&oneWire);
- TM1637Display display(CLK, DIO);
-
-
- void setup() {
- WiFi.begin(ssid, password);
-
- // put your setup code here, to run once:
- Serial.begin(9600);
- sensor.begin();
- display.setBrightness(0);
-
- Serial.print("Connecting");
- while (WiFi.status() != WL_CONNECTED) {
- delay(500);
- Serial.print(".");
- }
- Serial.println();
-
- Serial.print("Connected, IP address: ");
- Serial.println(WiFi.localIP());
- }
-
- void loop() {
- int temp = temperatureTrucs();
- //Serial.println(temp);
- display.showNumberDecEx(temp, 0x20);
-
- //;
- }
-
- int temperatureTrucs()
- {
- sensor.requestTemperatures();
- while (!sensor.isConversionComplete()); // wait until sensor is ready
- return (int) (sensor.getTempC() * 10);
- }
|