// Distributed with a free-will license. // Use it any way you want, profit or free, provided it fits in the licenses of its associated works. // MCP3425 // This code is designed to work with the MCP3425_I2CADC I2C Mini Module available from ControlEverything.com. // https://www.controleverything.com/content/Analog-Digital-Converters?sku=MCP3425_I2CADC#tabs-0-product_tabset-2 #include  #include  #include  #include  // MCP3425 I2C address is 0x68(104) #define Addr 0x68 const char* ssid = "Walker W"; const char* password = "mitzy1mitzy"; float degree; ESP8266WebServer server(80); void handleroot() {   unsigned int data[2];   // Start I2C Transmission   Wire.beginTransmission(Addr);   // Send configuration command   // Continuous conversion mode, 12-bit resolution   Wire.write(0x10);   // Stop I2C Transmission   Wire.endTransmission();   delay(300);   // Start I2C Transmission   Wire.beginTransmission(Addr);   // Select data register   Wire.write(0x00);   // Stop I2C Transmission   Wire.endTransmission();   // Request 2 bytes of data   Wire.requestFrom(Addr, 2);   // Read 2 bytes of data   // raw_adc msb, raw_adc lsb   if (Wire.available() == 2)   {     data[0] = Wire.read();     data[1] = Wire.read();   } const int analogInPin = A0;  // ESP8266 Analog Pin ADC0 = A0 int sensorValue = 0;   void setup() {   // initialize serial communication at 115200   Serial.begin(115200); } void loop() {   // read the analog in value   sensorValue = analogRead(analogInPin);     // print the readings in the Serial Monitor   Serial.print("sensor = ");   Serial.print(sensorValue);      delay(100);      // Output data to web server   server.sendContent   (""    "Antenna Direction"    "www.BDARS.org.au
"    "VK4RDB Mount Cotton");   server.sendContent    ("Serial.print("Digital Value of Analog Input : "); + String(sensorValue)); } void setup() {   // Initialise I2C communication as MASTER   Wire.begin(2, 14);   // Initialise serial communication, set baud rate = 115200   Serial.begin(115200);   // Connect to WiFi network   WiFi.begin(ssid, password);   // Wait for connection   while (WiFi.status() != WL_CONNECTED)   {     delay(500);     Serial.print(".");   }   Serial.println("");   Serial.print("Connected to ");   Serial.println(ssid);   // Get the IP address of ESP8266   Serial.print("IP address: ");   Serial.println(WiFi.localIP());   // Start the server   server.on("/", handleroot);   server.begin();   Serial.println("HTTP server started"); } void loop() {   server.handleClient(); }