#include <ESP8266WiFi.h>
#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

float tempc;

WiFiServer server(80);

void setup() {
  Serial.begin(9600);
  WiFi.mode(WIFI_AP);
  WiFi.softAP("CrushHack", "crushing");
  server.begin();
  sensors.begin();
}

void loop() {
  sensors.requestTemperatures();
  WiFiClient client = server.available();
  client.print(sensors.getTempCByIndex(0));
  Serial.println(sensors.getTempCByIndex(0));
  delay(500);
}
esp8266/ap_ds1820.txt · Last modified: 2024/11/14 02:30 by 127.0.0.1
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0