Studentergaarden / toiletduinoWEB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Toiletlogget,

Logger tiden toiletdøren er låst og sender det til en server via TCP.

Kræver Arduino og Lan/wifi-shield

I2C

I2C address scanner

 //Written by Nick Gammon
// Date: 20th April 2011

#include <Wire.h>

void setup() {
  Serial.begin (115200);

  // Leonardo: wait for serial port to connect
  while (!Serial)
    {
    }

  Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
 
  Wire.begin();
  for (byte i = 1; i < 120; i++)
  {
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      count++;
      delay (1);  // maybe unneeded?
      } // end of good response
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup

void loop() {}

I2C scanner. Scanning … Found address: 39 (0x27) Done. Found 1 device(s).

  • Set ip/mac/device name/id of toilets/showers/ by network call and save to eeprom, eg: set ip 172.16.10.3 etc

About


Languages

Language:Arduino 81.2%Language:OpenSCAD 13.4%Language:Makefile 5.5%