text:
Arduino Micro + W5500 module from AliExpress
Got this module from Aliexpress

W5500 Ethernet Network Modules For Arduino TCP/IP 51/STM32 SPI Interface 3.3V 5V I/O MCU
... and trying to hook this up to my proto Aduino Micro as thus:
Micro -> W5500 module

5V (J6.6) ->  5V   (I noted that it has a linear regulator to 3V3 on the W5500 board)

IO11 (J5.16) -> RST ... (I connected it to Pin 11 so that I can do a manual reset, to see if it made a difference, it didn't)

IO10 (J5.15-> SCS

SCLK (J6.1) -> SCLK

MISO (J6.2)-> MISO

MOSI (J5.1)-> MOSI

GND (J6.4)-> GND

I then used a modified version of WebServer to test the functioning of the module:
/*
  Web Server

 A simple web server that shows the value of the analog input pins.
 using an Arduino Wiznet Ethernet shield.

 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 * Analog inputs attached to pins A0 through A5 (optional)

 created 18 Dec 2009
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe
 modified 02 Sept 2015
 by Arturo Guadalupi

 */

#include <SPI.h>
#include <Ethernet.h>

int counter = 0;
const int W5500_RESET_PIN = 11;     // the number of the pushbutton pin

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
  0xDE, 0xED, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 2, 177);

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // Reset the W5500 module
  pinMode(W5500_RESET_PIN, OUTPUT);
  digitalWrite(W5500_RESET_PIN, HIGH);
  digitalWrite(W5500_RESET_PIN, LOW);
  delay(100);
  digitalWrite(W5500_RESET_PIN, HIGH);
  delay(100);

  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());
}

void loop() {

  if (counter > 0) counter--;
  else
  {
    Serial.print("server is at ");
    Serial.println(Ethernet.localIP());
    counter = 10000;
  }

  // listen for incoming clients
  EthernetClient client = server.available();
  if (client) {
    Serial.println("new client");
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connection: close");  // the connection will be closed after completion of the response
          client.println("Refresh: 5");  // refresh the page automatically every 5 sec
          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("");
          // output the value of each analog input pin
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            int sensorReading = analogRead(analogChannel);
            client.print("analog input ");
            client.print(analogChannel);
            client.print(" is ");
            client.print(sensorReading);
            client.println("
");
          }
          client.println("");
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        } else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
    Serial.println("client disconnected");
  }
}

The code runs ok, and as you can see I'm printing out debug comms and monitoring using TeraTerm on the USB virtual port. However I'm seeing this output:
server is at 222.237.190.239

server is at 222.237.190.239

server is at 222.237.190.239

server is at 222.237.190.239

server is at 222.237.190.239

server is at 222.237.190.239

So ... the IP address didn't take, and needless to say that the webpage didn't show up when I typed in the IP address 192.168.2.177.
I've tried two identical W5500  modules so far and the problem persists for both in a consistent way. I've looked on the scope and I can see the SCLKs shooting across in 4 lots of clock bursts per each SCS low going pulse, with both the MISO and MOSI lines showing what appears to be "data" ... :)
The W5500 module itself has a power LED which is lit, the 5V is correctly regulating down to 3V3 and the 3V3 pin of the W5500 chipset IC appears to be connected. Both the LEDs on the ethernet balun appears to be turned on and blinking some of the times.
So ... erm ... help? ... what am I doing wrong? What else should I check?
2017-10-08 Update:
Tried Ethernet2 library update from github adafruit ethernet2 libary.
But getting compiling errors now:
    Arduino: 1.6.12 (Windows 7), Board: "Arduino/Genuino Micro"
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Hemon\Documents\Arduino\libraries -fqbn=arduino:avr:micro -vid-pid=0X2341_0X8037 -ide-version=10612 -build-path C:\Users\Hemon\AppData\Local\Temp\arduino_build_838983 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose Z:\Quantum Sensing Limited\Consulting Work\Arduino\WebServer\WebServer.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Hemon\Documents\Arduino\libraries -fqbn=arduino:avr:micro -vid-pid=0X2341_0X8037 -ide-version=10612 -build-path C:\Users\Hemon\AppData\Local\Temp\arduino_build_838983 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose Z:\Quantum Sensing Limited\Consulting Work\Arduino\WebServer\WebServer.ino
Using board 'micro' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
WARNING: Category 'Device' in library ParPrinter is not valid. Setting to 'Uncategorized'
WARNING: Category 'Device' in library Radar is not valid. Setting to 'Uncategorized'
Detecting libraries used...
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8037 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Micro"' "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "C:\Users\Hemon\AppData\Local\Temp\arduino_build_838983\sketch\WebServer.ino.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8037 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Micro"' "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" "C:\Users\Hemon\AppData\Local\Temp\arduino_build_838983\sketch\WebServer.ino.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8037 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Micro"' "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" "-IC:\Program Files (x86)\Arduino\libraries\Ethernet\src" "C:\Users\Hemon\AppData\Local\Temp\arduino_build_838983\sketch\WebServer.ino.cpp" -o "nul"
Using cached library dependencies for file: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src\SPI.cpp
Using cached library dependencies for file: C:\Program Files (x86)\Arduino\libraries\Ethernet\src\Dhcp.cpp
Using cached library dependencies for file: C:\Program Files (x86)\Arduino\libraries\Ethernet\src\Dns.cpp
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8037 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Micro"' "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" "-IC:\Program Files (x86)\Arduino\libraries\Ethernet\src" "C:\Program Files (x86)\Arduino\libraries\Ethernet\src\Ethernet.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8037 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Micro"' "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" "-IC:\Program Files (x86)\Arduino\libraries\Ethernet\src" "C:\Program Files (x86)\Arduino\libraries\Ethernet\src\Ethernet2.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8037 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Micro"' "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" "-IC:\Program Files (x86)\Arduino\libraries\Ethernet\src" "C:\Program Files (x86)\Arduino\libraries\Ethernet\src\EthernetClient.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8037 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Micro"' "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" "-IC:\Program Files (x86)\Arduino\libraries\Ethernet\src" "C:\Program Files (x86)\Arduino\libraries\Ethernet\src\EthernetServer.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8037 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Micro"' "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" "-IC:\Program Files (x86)\Arduino\libraries\Ethernet\src" "C:\Program Files (x86)\Arduino\libraries\Ethernet\src\EthernetUdp.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8037 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Micro"' "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" "-IC:\Program Files (x86)\Arduino\libraries\Ethernet\src" "C:\Program Files (x86)\Arduino\libraries\Ethernet\src\EthernetUdp2.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8037 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Micro"' "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" "-IC:\Program Files (x86)\Arduino\libraries\Ethernet\src" "C:\Program Files (x86)\Arduino\libraries\Ethernet\src\Twitter.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8037 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Micro"' "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" "-IC:\Program Files (x86)\Arduino\libraries\Ethernet\src" "C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\socket.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8037 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Micro"' "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" "-IC:\Program Files (x86)\Arduino\libraries\Ethernet\src" "C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5100.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8037 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Micro"' "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" "-IC:\Program Files (x86)\Arduino\libraries\Ethernet\src" "C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5200.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8037 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Micro"' "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" "-IC:\Program Files (x86)\Arduino\libraries\Ethernet\src" "C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp" -o "nul"
Generating function prototypes...
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8037 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Micro"' "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" "-IC:\Program Files (x86)\Arduino\libraries\Ethernet\src" "C:\Users\Hemon\AppData\Local\Temp\arduino_build_838983\sketch\WebServer.ino.cpp" -o "C:\Users\Hemon\AppData\Local\Temp\arduino_build_838983\preproc\ctags_target_for_gcc_minus_e.cpp"
"C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino10/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\Hemon\AppData\Local\Temp\arduino_build_838983\preproc\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8037 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Micro"' "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" "-IC:\Program Files (x86)\Arduino\libraries\Ethernet\src" "C:\Users\Hemon\AppData\Local\Temp\arduino_build_838983\sketch\WebServer.ino.cpp" -o "C:\Users\Hemon\AppData\Local\Temp\arduino_build_838983\sketch\WebServer.ino.cpp.o"
Compiling libraries...
Compiling library "SPI"
Using previously compiled file: C:\Users\Hemon\AppData\Local\Temp\arduino_build_838983\libraries\SPI\SPI.cpp.o
Compiling library "Ethernet"
Using previously compiled file: C:\Users\Hemon\AppData\Local\Temp\arduino_build_838983\libraries\Ethernet\Dhcp.cpp.o
Using previously compiled file: C:\Users\Hemon\AppData\Local\Temp\arduino_build_838983\libraries\Ethernet\Dns.cpp.o
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_MICRO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8037 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Micro"' "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\micro" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" "-IC:\Program Files (x86)\Arduino\libraries\Ethernet\src" "C:\Program Files (x86)\Arduino\libraries\Ethernet\src\Ethernet.cpp" -o "C:\Users\Hemon\AppData\Local\Temp\arduino_build_838983\libraries\Ethernet\Ethernet.cpp.o"
C:\Program Files (x86)\Arduino\libraries\Ethernet\src\Ethernet.cpp: In member function 'int EthernetClass::begin()':

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\Ethernet.cpp:26:3: error: 'W5500' was not declared in this scope

   W5500.init();

   ^

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\Ethernet.cpp:37:5: error: 'W5100' was not declared in this scope

     W5100.setIPAddress(_dhcp->getLocalIp().raw_address());

     ^

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\Ethernet.cpp: In member function 'void EthernetClass::begin(IPAddress, IPAddress, IPAddress, IPAddress)':

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\Ethernet.cpp:72:3: error: 'W5100' was not declared in this scope

   W5100.init();

   ^

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\Ethernet.cpp: In member function 'int EthernetClass::maintain()':

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\Ethernet.cpp:158:9: error: 'W5100' was not declared in this scope

         W5100.setIPAddress(_dhcp->getLocalIp().raw_address());

         ^

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\Ethernet.cpp: In member function 'IPAddress EthernetClass::localIP()':

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\Ethernet.cpp:174:3: error: 'W5100' was not declared in this scope

   W5100.getIPAddress(ret.raw_address());

   ^

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\Ethernet.cpp: In member function 'IPAddress EthernetClass::subnetMask()':

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\Ethernet.cpp:181:3: error: 'W5100' was not declared in this scope

   W5100.getSubnetMask(ret.raw_address());

   ^

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\Ethernet.cpp: In member function 'IPAddress EthernetClass::gatewayIP()':

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\Ethernet.cpp:188:3: error: 'W5100' was not declared in this scope

   W5100.getGatewayIp(ret.raw_address());

   ^

Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI
Using library Ethernet at version 1.0.4 in folder: C:\Program Files (x86)\Arduino\libraries\Ethernet
exit status 1
Error compiling for board Arduino/Genuino Micro.
Invalid version found: 0.1.03
Invalid version found: 0.1.04
Invalid version found: 0.1.06
Invalid version found: 0.1.04
Invalid version found: 0.1.07
Invalid version found: 0.1.02
Invalid version found: 0.1.09
Invalid version found: 0.1.00
Invalid version found: 0.1.05
Invalid version found: 0.1.01
Invalid version found: 0.1.06
Invalid version found: 0.1.01
Invalid version found: 0.1.04
Invalid version found: 0.1.07
Invalid version found: 0.1.04
Invalid version found: 0.1.03
Invalid version found: 0.1.03
Invalid version found: 1.2.03
Invalid version found: 0.1.03
Invalid version found: 0.1.08
Invalid version found: 0.1.04
Invalid version found: 0.1.05
Invalid version found: 0.1.05
Invalid version found: 0.1.00
Invalid version found: 0.1.00
Invalid version found: 0.1.00
Invalid version found: 0.1.00
Invalid version found: 0.1.00
Invalid version found: 0.1.01
Invalid version found: 0.1.09
Invalid version found: 0.1.03
Invalid version found: 0.1.00
Invalid version found: 0.1.00
Invalid version found: 0.1.06
Invalid version found: 0.1.03
Invalid version found: 0.1.04
Invalid version found: 0.1.06
Invalid version found: 0.1.04
Invalid version found: 0.1.07
Invalid version found: 0.1.02
Invalid version found: 0.1.09
Invalid version found: 0.1.00
Invalid version found: 0.1.05
Invalid version found: 0.1.01
Invalid version found: 0.1.06
Invalid version found: 0.1.01
Invalid version found: 0.1.04
Invalid version found: 0.1.07
Invalid version found: 0.1.04
Invalid version found: 0.1.03
Invalid version found: 0.1.03
Invalid version found: 1.2.03
Invalid version found: 0.1.03
Invalid version found: 0.1.08
Invalid version found: 0.1.04
Invalid version found: 0.1.05
Invalid version found: 0.1.05
Invalid version found: 0.1.00
Invalid version found: 0.1.00
Invalid version found: 0.1.00
Invalid version found: 0.1.00
Invalid version found: 0.1.00
Invalid version found: 0.1.01
Invalid version found: 0.1.09
Invalid version found: 0.1.03
Invalid version found: 0.1.00
Invalid version found: 0.1.00
Invalid version found: 0.1.06

Any ideas?

BTW ... I was following this instructable, http://www.instructables.com/id/Arduino-Nano-with-WIZ550io-Easy-Internet/ ... and I did update the wiznet library as it suggests.

The sharp eyed observers would notice that 222.237.190.239 is 0xDEEDBEEF ... which is part of the Mac. So I'm rather confused here.

original Arduino shield with W5500 needs the Ethernet2 library. try it

Thanks Juraj ... but i'm getting compiling errors now, I've updated the original post above.

Note that even the stock WebServer example in Ethernet2 folder doesn't compile correctly. I've restarted Arduino IDE with no luck.

Solved it ... needed to create a new Ethernet2 folder and copy the Ethernet2 library files into it, and now it works great! The Ethernet2 library is a stand alone and different library to the Ethernet one.

For the W5500 chip use the Ethernet2 library. It can be can be found and installed in Library Manager in Arduino IDE.
UPDATE 2018: The Arduino Ethernet library version 2.00 now supports W5200 and W5500.

beside any other coding and library issues: IP Groups are seperated by DOT not comma! If lucky, the interpreter ist Syntax-tollerant. Your Observation for the IP xx.xx.xx.139 could be the indication of the software trying to solve the issue semi-effectively.

Change the MISO & MOSI Signal between Micro & W5500 module, now it works with both Etherenet2 & Ethernet Libs. btw Ethernet2 is better see ram.

2 years ago when the Question was asked Erhernet library didn't support W5500. and why should OP change the MISO & MOSI and how?


text:
TimerOne.h library for nodeMCU
Following is the code I found in Arduino example files. It compiled fine on Arduino UNO. But there was an error when I tried to compile it for nodeMCU 1.0(ESP 12E Module).
#include <TimerOne.h>
void setup() {
  pinMode(13,OUTPUT);
  Timer1.initialize(5000000);//5 sec
  Timer1.attachInterrupt(timerIsr);
}
void loop() {}
void timerIsr(){
  digitalWrite(13,!digitalRead(13));
}

Following was the error message. I had this kind of error previously on OneWire.h and I solved it by replacing the OneWire.h library with another OneWire.h library that was made especially for nodeMCU.
Error msg:
Arduino: 1.8.3 (Windows 8.1), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"

In file included from D:\iox Prime\TEC project\code\building modules\timerIsrDemo\timerIsrDemo.ino:1:0:

C:\Program Files (x86)\Arduino\libraries\TimerOne/TimerOne.h:39:20: fatal error: avr/io.h: No such file or directory

 #include <avr/io.h>

                    ^

compilation terminated.

exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I searched the library everywhere in the internet to solve this error but end up with no success. I wish somebody modifies the existing library for me. Thank you for the help.

I have found a solution. There is a library called Ticker.h
I found this on github: https://github.com/esp8266/Arduino/tree/master/libraries/Ticker
Following is my demo code:
#include <Ticker.h>
Ticker ticker;
void setup() {
  pinMode(D7,OUTPUT);
  ticker.attach(1,isrFunc);//tickerObj.attach(timeInSecs,isrFunction)
}

void loop() {}
void isrFunc(){
  digitalWrite(D7,!digitalRead(D7));
}

For me, this code worked seamlessly on nodeMCU. Thank you.

The TimerOne library is specifically for Timer 1 on the AVR microcontrollers1. No other microcontroller has the exact same timer structure, so the library cannot be used with them.
You need a library that works with the timers the ESP8266 has, or you need to manually manipulate the timer registers, for which you will need to consult and understand the datasheet.

1: It also appears to have #defines in it for ARM (Teensy 3.x) chips.

There is a another Ticker.h for non ESP processors like UNO, see below:
// Filename: Ticker_Example - Does'nt work on ESP)
// this is based upon published version V3 of 3/2018
// refer to : https://github.com/sstaub/Ticker/blob/master/examples/Example.ino
// Complete example. Here we created five timers, you can run it and test the result
// in the Serial monitor and the on board LED.
#include "Ticker.h"

void printMessage();
void printCounter();
void printCountdown();
void blink();
void printCountUS();

bool ledState;
int counterUS;

/*
Creates a Ticker object          Constructors / Destructor
Ticker(fptr callback, uint32_t interval, uint16_t repeats = 0, resolution_t resolution = MICROS)
    parameter callback for the function name you want to call
    parameter interval sets the interval time in ms or us when using MICROS_MICROS with the resolution parameter
    parameter repeats sets the number of repeats the callback should executed, 0 is endless
    parameter resolution sets the internal resolution of the Ticker, it can MICROS, MICROS_MICROS or MILLIS
or in Ray's simpler terms...  Ticker (give it a name)(the callback function, interval, number of times, resolution)
*/
Ticker timer1(printMessage, 0, 1);      // once, immediately
Ticker timer2(printCounter, 1000, MILLIS);  // internal resolution is milli seconds
Ticker timer3(printCountdown, 1000, 5);   // countdown 5 times, every second
Ticker timer4(blink, 500);          // changing led every 500ms
// Ticker timer5(printCountUS, 100, 0, MICROS_MICROS); // originally used 'MICRO_MICROS' so the the interval time would be 100us
                                             //with a internal resolution of micro seconds BUT this did not compile
Ticker timer5(printCountUS, 2000, 0, MICROS);  // now set to 2 seconds

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(9600);
  delay(2000);
  timer1.start();
  timer2.start();
  timer3.start();
  timer4.start();
  timer5.start();
  }

void loop() {
  timer1.update();
  timer2.update();
  timer3.update();
  timer4.update();
  timer5.update();
  }

void printCounter() {
  Serial.print("Counter ");
  Serial.println(timer2.getRepeatsCounter());
//  Serial.println(timer2.counter()); // this original line did not compile
  }

  void printCountdown() {
    Serial.print("Countdown ");
    Serial.println(timer3.getRepeats() - timer3.getRepeatsCounter());
    // Serial.println(4 - timer3.counter());  // this original line did not compile
    }

void printMessage() {
  Serial.println("Hello!");
  }

void blink() {    // blink every 500ms
  digitalWrite(LED_BUILTIN, ledState);
  ledState = !ledState;
  }

void printCountUS() {
  counterUS++;
 // if (counterUS == 10000) {
 // Serial.println("10000 * 100us");
  if (counterUS == 5) {
    Serial.print("5 * 2000mS when millis = ");
    Serial.println(millis());
    counterUS = 0;
    }
  }

/*
Functions called in format 'timer1.start();' for the Ticker previously named timer1

void start()
Start the Ticker. Will count the interval from the moment that you start it. If it is paused, it will restart the Ticker.

void resume()
Resume the Ticker. If not started, it will start it. If paused, it will resume it. For example, in a Ticker of 5 seconds, if it was paused in 3 seconds, the resume in continue in 3 seconds. Start will set passed time to 0 and restart until get 5 seconds.

void pause()
Pause the Ticker, so you can resume it.

void stop()
Stop the Ticker.

void update()
Must to be called in the loop(), it will check the Ticker, and if necessary, will run the callback

status_t state()
Returns the state of the Ticker.

uint32_t elapsed()
Returns the time passed since the last tick, ms or us depending from the resolution.

uint16_t counter()
Returns the number of executed callbacks.
  */

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
What's the problem with program , continously beeping buzzer
I have used PIR motion sensor with arduino Uno r3, alongwith one piezo buzzer. and the program is as
 /*
 * PIR sensor tester
 */

int ledPin = 13;                // choose the pin for the LED
int inputPin = 2;               // choose the input pin (for PIR sensor)
int pirState = LOW;             // we start, assuming no motion detected
int val = 0;
int piezoPin = 11;
// variable for reading the pin status

void setup() {
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);
  pinMode(piezoPin, OUTPUT);
  Serial.begin(9600);
  // declare sensor as input

}

void loop(){
  val = digitalRead(inputPin);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
    digitalWrite(ledPin, HIGH);
    tone(piezoPin,300,160);
    delay(150);

    // turn LED ON
    if (pirState == LOW) {
      // we have just turned on

      // We only want to print on the output change, not state
      pirState = HIGH;
    }
  } else {
    digitalWrite(ledPin, LOW);
    tone(piezoPin,0,0);
    delay(300);

    // turn LED OFF
    if (pirState == HIGH){
      // we have just turned of

      // We only want to print on the output change, not state
      pirState = LOW;
    }
  }
}

but it supposed to ring buzzer at the time of pir motion sensor getting signal. But buzzer continuously ringing and at the time of pir sensor getting signal, it just ring louder. What is the problem in program``

Do you have a "buzzer" or a "transducer"? One makes sound by itself when provided with power, and the other needs an audio signal. Your code is for the latter. If you have the former it won't work right.

noTone()
Description
Stops the generation of a square wave triggered by tone(). Has no effect if no tone is being generated.
NOTE: if you want to play different pitches on multiple pins, you need to call noTone() on one pin before calling tone() on the next pin.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Description about arduino relay
I have this relay module. I don't understand what is a role of the jumper on it (for now it's shorting the jd-vcc (what??) and vcc pins).

The jd-vcc pin can be used to power the relay coils using a separate 5V power supply. Why would you want to do that? Each relay coil draws about 73mA @ 5VDC when energized. Theres a circuit schematic on this website: http://howtomechatronics.com/tutorials/arduino/control-high-voltage-devices-arduino-relay-tutorial/

Hello! Thanks a lot. In this diagram (http://howtomechatronics.com/wp-content/uploads/2015/09/Arduino-Relay-Module-Circuit-Diagram.png) I don't understand why it's not needed to connect in addition GND from arduino to relay, to make the same ground in the system... Can you explain it please?

@Michael  In the tutorial, he's supplying 5V to the VCC pin and grounding the In1 pin using an Arduino digital pin. Have a look at the circuit schematic on the tutorial page and follow the "path" the current is taking. Current flows from VCC, through resistor R1, through the LED inside the optocoupler and finally through a diode DS1 to pin In1 on the relay board. When the Arduino digital pin is commanded LOW, it provides the ground for the optocoupler LED, turning it on. The digital pin is only suppling a ground for an LED.

@Michael  When the digital pin is made HIGH, there is 5V at pin In1. Diode DS1 is reverse biased so current can't flow from In1 through the circuit and current can't flow from VCC through the LED because it needs a ground to complete the circuit. If you wanted to power the relay board using an Arduino, then you would leave the jumper in place and connect both the 5V and ground connections. In1 would still be connected to a digital pin and work the same way. Keep in mind that each relay draws 73mA of current when energized.

@Michael: both GND pins on the relay module are already connected, check the continuity. that said, the illustration is missing the AVR power connection, and that indeed could be isolated, in which case it's wrong, and you'd need to common all the GNDs


text:
Mixing analog reads with raw port reads
I'm reading two digital inputs and one analog input. For [reasons] I must use A0 and A1 as digital ins, and A2 as an analog in.
I'm uncertain about how the Arduino hardware deals with mixing analog and digital inputs on the same port. For speed, I'm reading like this:
 uint8_t raw = PINC;
 boolean digitalA = (bool)(raw & 1);  // read A0
 boolean digitalB = (bool)(raw & 2);  // read A1
 int analogC = analogRead(A2);

Will the raw reading of the port interfere with the analogRead in any way? I did see a caveat about mixing A & D, but it only had to do with noise introduced in the analog ins when doing digital outs. Would reading analog first minimize that?

Ah, I see what you are asking.  Instead of using individual pin reads you are simply reading the entire set of Analog pins (0-5) then using an analogRead on pin 2.   I don't think this should be a problem.  But you may want to try using individual pin reads to see if it makes any difference.

@st2000 - Thanks. The concern is that performing a raw read may disrupt the ADC process. I'm coding in advance of having equipment available, that's why I'm asking about this rather than just experimenting. The actual code is more complicated than the simple example here.

What you are trying to do is perfectly safe. In fact, you reading PINC
will have no effect whatsoever on the input circuitry. You are just
reading an I/O register and, whether you read it or not, this register
is updated on every clock cycle from a set of comparators that monitor
the pin voltages.
Just for completeness, I should mention that it is possible to disable
the comparators that update the register. The Atmel datasheet recommends
to disable them if you want the lowest possible ADC noise. If you follow
that recommendation, then reading PINC will just return zero. The
Arduino core library does not disable them: the input comparators are
thus always active, and you can get a meaningful value by reading that
digital input register.
Edit: You can selectivly disable the input comparator on the pin
A2 by issuing DIDR0 |= _BV(ADC2D);. But that is only useful if you
really need to maximize the accuracy.

I agree, it is perfectly safe. The AVR microcontrollers have different kind of internal hardware parallel on the same pin. The digital part and the analog part are default both active and can both be used at the same time. They use the same pin, that's all, there is no internal mix.

In general, most embedded processors multiplex external pins into specialized internal circuits.  Circuits which check standard fixed threshold crossings (digital inputs), circuits which check variable threshold crossings (comparators) and circuit which combine comparators with a variable settable reference (analog to digital converter) to name only three.
Usually a pin is multiplexed to a particular internal circuit only once during initialization.  Switching between internal circuits as part of normal operation is tricky and can lead to unexpected results.
Analog reads are often problematic because of noise.  However, it is unlikely that reading the state of a digital input will effect the conversion of the ADC circuit.
It would be far more effective to read the actual processor's application note you are using and understand that processor's ADC issues.  You may be surprised that the number is significant bits (usable bits) are less than the number found in the ADC register.  Or that you can increase the number of significant bits simply by adding averaging to your software.

What part of initialization maps an analog pin to a digital input? As far as I can tell, using pinMode() to set A0..A5 as input doesn't specify how the input will be read from that pin -- that's determined by analogRead() vs digitalRead(), not fixed at init time. Yes? And I'm not using digitalRead() but raw port access, hence the question.


text:
Can I use an Arduino Uno to support an RFID reader, Zigbee module and a touch screen at the same time?
I'm almost a beginner to microcontrollers and have done a few simple projects, but this time I have to use an Arduino Uno (powered by a battery) to support an RFID reader (RC522), a Zigbee module and a touch screen altogether. Apparently there are too few pins to support all the modules. What is the easiest way to implement such a system?

use an i2c or spi screen. try to match that protocol with your other modules. with all i2c modules, you can connect all three with only 2 pins. With all SPI, you still only need 5 or 6 pins.

Also I don't know what the RFID, zigbee and touch screen uses (generic GPIO pins, I2C, SPI, something else)?
You always can combine multiple inputs/outputs using a multiplexer (i.e. 74HC165, 74HC595), although it will mean extra software and less performance.
About the touch screen, that might be problematic regarding performance and memory usage, since the Uno has only a few KB and even the more expensive Arduino's do not have that much memory you might need.


text:
How can i tell the power status of a GSM900
What I am after is a reliable way of telling whether the GSM900 shield is powered up or not.  "Obviously" the shield power is the constant green light.  But i'm talking about the red light on the other side (next to the flashing green light).
I know i can PowerUp/Down by using the code
digitalWrite(9, HIGH);
Serial.println("write 9 high");
delay(1000);
digitalWrite(9, LOW);
Serial.println("write 9 low");
delay(5000);

And from the AT command manual, I can Power it down by using the command...
AT+CPOWD=1

So it seems that the only way I can ensure that the board is On, is to power it down and then toggle the power.  Surely there's a better way than that?
Another idea is to issue a simple "AT" command, and if I get back "OK" then its on, and if I dont get anything back (timeout of maybe 2 seconds), then its off - thoughts?

the AT command seems decent, but 2 secs is a long time, shouldn't it be a few dozen ms max? you can also solder a bodge wire to the red led annode and feed that to an input to read().


text:
Where to remove an ADC bias?
I'm using several ACS712-based 5A current sensors. They're non-polar and so (I gather) the output is biased to Vcc/2 to allow a swing in either direction. The sensor outputs +/- 185mV/A, plus the bias.
The example sketch I've seen does a computation like amps = ((analogRead(A0) * 5.0) / 1023) - 2.5 (where 2.5v is the bias).
In my case the actual current value and polarity aren't important, just the presence of current. Is there anything untoward about doing this instead?
boolean isCurrent = (abs(analogRead(A0) - 512) > thresholdValue);

This avoids floating point (unless abs() forces it?) and an ADC count of 512 should be equivalent to a bias of Vcc/2. The threshold just cores out some noise / jitter / drift. Seem OK? Can anyone suggest a better approach?

yes, but most (all?) of the "negative" is noise anyway right? or is the flow reversible?

@dandavis - For any given sensor the flow will be one-way, but I can't assume that all will be wired the same. There are 12+ of these and their inputs will arrive as pairs of black wires. Since the reading code is common to all (in a loop), I have to accommodate both polarities.

No, there is nothing untoward about that - it is perfectly acceptable and, in fact recommended, since as you note it uses no floating point.


text:
Servo motors suddely stopped moving and a clicking sound can be heard
I think I might have shorted something by accident. I have just purchased the Elegoo Robot Car Kit v2.0. Putting things together was relatively easy. I also managed to run the first example, which basically turns on and off the servos indefinitely for short periods of time making the small robot drive in one direction forwards, then go backwards, spin a little to pick another direction and repeat.
The second thing I wanted to test was the IR remote control. For some reason the LED that is part of the small board where the IR diode is placed didn't blink at all whenever I was pressing a button on the remote control. The car also didn't move even the slightest.
So it was time to get the multimeter out and test what goes on. The problem is that the thing is very small and I accidentally rubbed one lead into the other while having current flowing. The result - everything shutdown...slowly.
Needless to say I got scared that the board (Elegoo's version of the Arduino UNO R3) died. However it seems that's not the case since upon turning it off (I tried both the USB as well as the batteries as a power source) the ON LED turned on and the other LED that is supposed to be blinking is blinking. The sensor board (it allows connecting IR, Bluetooth, the ultrasonic sensor etc. to the Arduino board) also has it's red LED turned on.
However using the same example program now my robot is not moving at all. Instead I can hear at least from on of the motors a clicking sound and also tiny vibration which (it seems) is caused by the motor where the sound comes from and is the result of it attempting to move the wheel attached to it.
I checked the power connector of the servo control board (an H-bridge for 4 servos - one per wheel; uses the L298N) and when I turn on the batteries I get approx. 8.2V which is what I'm expecting to get (two rechargeable Li-Ion batteries BRC 18650 4200mAh, 3.7V each - why I get the higher reading is beyond me). So it's not that the board doesn't get the power. Something else is causing the issue and because of my lack of knowledge I am stuck wondering what has happened.
PS: The IR tranceiver seems to work or at least the LED attached to it blinks now whenever I press a button on the remote control. XD
EDIT: Small update. Sometimes the servos do work. After the n-th time turning the thing on and off all of a sudden all the wheels started moving. But then they stopped again.

You have added few facts, data, schema and other info so it's hard to guess what you have. So a general answer would be, you have blow'n someting when you shorten it.

It's really difficult to provide those. The kit's documentation is basically pictures and a little bit of text but nothing fancy like data sheets or schema.

Then it's rely hard to assist you.

I've also just experienced the strangest thing - the servos started moving for a short period of time but then stopped again.

That's OK that the kit's documentation is short.  We don't want to see the instructions you followed.  If you had it just like that it would work.  We want to see what you actually have.  Grab a piece of paper and a pen and draw a schematic of how you have it wired.  Include your code int he question.  Can you not imagine how impossible it is to help you when we can't see the project?

Will do my best. Meanwhile I'll try to exclude as many of the pieces involved as possible to narrow down that spot where the problem is.


text:
How many Infrared sensor modules can be added to a single Arduino (eg;Uno)
I am looking to add block detection to my model railroad. I need approx. 40 infrared sensors to power 40 LED's on my control panel. No signals or other logic required yet, just the LED indications -LED- on=occupied  off=vacant.
How many Uno boards would I need to do this? I may, in the future, look at integrating several two (or three) aspect signals down the track. I am an absolute novice here, never having used an Arduino, nor done any coding of any sort.

One Arduino with "I2C I/O exoanders" is enough.

an infrared sensor would not be a good way of telling if an area is occupied or not, only that the occupation has changed at one snapshot in time. can you use super magnets and cheap hall sensors instead? look into reflective sensors and beam interupts as well.

The IR sensors power the LED's in the control panel. The underside of the train reflects the IR beam and the current from the detector lights the LED. Once the train has passed, the beam is uninterrupted and therefore no signal is detected, no lighting of LED. I am looking at using TCRT5000 reflective optical sensor switch for Arduino - I just need to know how many I can attach to a board...

Ahh, I assumed PIR, my bad. it depends on the code, but i doubt you need interrupt-quality timing for trains. With polling, you get at least 16, maybe a couple more without any other hardware. Make sure you have enough juice to power them all. if you get into expanders or ADCs or shift registers, one uno can handle 40

Being an absolute novice, I have no idea what polling is, ADC or shift registers mean...Given the TCRT5000 has four pins, how many can I run off one board? Can I wire them in parallel, with 6 IR modules per section of track..?

some of the 4 pins can be wired together in parallel. in fact you'll need to do that or you'll run out of power pins quickly. but reading over it all again, from what you describe, i don't think you even need an ardiuno if you buy the right sensor modules; you don't need processing.

If the TCRT5000 sensors work with the circuit i found, I don't think I will need an Arduino either. Once I receive them I will check

You just want to know how many you can attach to an Arduino board or how many Arduino Uno boards you need, but it does not work like that.
Some sensors with a led require 5mA or 10mA or 20mA. The reflective optical sensors use a IR (InfraRed) led. The Arduino Uno 5V pin can probably not supply enough current for 40 leds. Therefor you might need a seperate power supply.
I think the TCRT5000 is typically set at 10mA.
The Arduino Mega 2560 and the Arduino Due have many pins. But with 40 TCRT5000 sensors, the total current is too close to the limit.
In such situation often extra hardware is added. You can use one Arduino Uno board, with extra hardware for multiple inputs or outputs.
An "expander" is a chip or a module that connects to the Arduino with a few wires, but has many input and/or output pins. For example a "expander" with I2C interface to the Arduino Uno as mentioned by @matsk. Although a I2C expander has a slow I2C interface, they are sometimes smart and can tell which pin has changed by reading a single byte.
"Shift registers" are chips with for example 8 input pins or 8 output pins. The data of the pins is shifted into the chip with a data and clock signal. There are many examples for that: ShiftOut with a 74HC595.
A analog "multiplexer" or "mux" is a chip that can connect one common pin to one of 8 pins. The signal can go both ways. Nick Gammon about a multiplexer.
A "ADC" is short for "Analog to Digital Converter". The Arduino Uno has an internal ADC, but also a external ADC can be used. They have often more than one analog input.
"Polling" is when an Arduino is reading many inputs continuously one by one. If for example it takes 5ms to read a sensor, then 40 sensors take 200ms. That means that every sensor is read once per 200ms. If a train would pass within that 200ms, then it might be not detected.
The opposite of polling is with interrupts. If an external event happens, it could trigger an interrupt and the Arduino can react right then at that very moment. However, 40 interrupts is not possible.
Conclusion:
The best way depends on your hardware and software skills, on the maximum interval that you want to read the sensors, on the sensors themself, and how far apart the sensors are, and if you want 40 wires to a Arduino board.
The best Arduino board also depends on what you want to do with the data and what else the Arduino has to do.
Some sensors have a analog output and some a digital output. It depends on your situation and the way the train is detected.
If possible, then I would choose a solution where all the hardware can be easily be replaced. If the sensor has digital outputs, then I would connect them to a Arduino Mega 2560 or Arduino Due.

That's great information, thank you for going to the trouble of explaining everything clearly for me! After doing a bit more research, it looks like it may be possible to achieve what I am looking for without having to use an Arduino at all - depends on how well the TCRT5000 works with a circuit I have found. This uses resistors and an LM358 opamp, resistors and a trim pot to adjust sensitivity. Once I receive my TCRT5000 modules I will wire up on a breadboard and see how it goes.


text:
The sensors don't send correct data
I try to make a weather station, but I don't understand why it doesn't work. I had tried to read a lot of the sensors but I doesn't find my errors.

The code:

 #include "DHT.h"
 #include "SFE_BMP180.h"
 #include "Wire.h"
 #include "MQ135.h"
 #include "SPI.h"
 #include "Adafruit_GFX.h"
 #include "Adafruit_ILI9341.h"
#define DHTPIN 2
 #define DHTTYPE DHT11
 DHT dht(DHTPIN, DHTTYPE);
SFE_BMP180 bmp180;
 double PresionNivelMar=1013.25;
int UVOUT = A3;
 int REF_3V3 = A1;
#define PIN_MQ135 A0
 MQ135 mq135_sensor = MQ135(PIN_MQ135);
#define TFT_DC 9
 #define TFT_CS 10
 Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
void setup() {
  Serial.begin(9600);
  dht.begin();
  if (bmp180.begin())
          Serial.println("BMP180 iniciado correctamenten");
        else {
          Serial.println("Error al iniciar el BMP180");
        }
  pinMode(UVOUT, INPUT);
  pinMode(REF_3V3, INPUT);
tft.begin();
  tft.setRotation(0);
  tft.fillScreen(ILI9341_BLACK);
  tft.setTextColor(ILI9341_DARKGREEN);
  tft.setTextSize(2);
  tft.setCursor(70,20);
  tft.print("S.E.M.S.");
  tft.setTextSize(1);
  tft.setTextColor(ILI9341_WHITE);
  tft.setCursor(20,310);
  tft.print("Colegio Panamericana");
  tft.setTextSize(1.5);
}
void loop() {
  char a;
  double T,P,A;
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  float rzero = mq135_sensor.getRZero();
  float correctedRZero = mq135_sensor.getCorrectedRZero(t, h);
  float resistance = mq135_sensor.getResistance();
  float correctedresistence = mq135_sensor.getCorrectedResistance(t, h);
  float ppm = mq135_sensor.getPPM();
  float correctedPPM = mq135_sensor.getCorrectedPPM(t, h);
Serial.println();
  Serial.print("Temperatura: ");
  Serial.print(t);
  Serial.print(" °C ");
  Serial.println();
  Serial.print("Humedad: ");
  Serial.print(h);
  Serial.print(" %RH");
  Serial.println();
a = bmp180.startTemperature();
  if (a != 0) {
    delay(a);
    a = bmp180.getTemperature(T);
     if (a != 0) {
         a = bmp180.startPressure(3);
        if (a != 0) {
                  delay(a);
                        a = bmp180.getPressure(P,T);
                 if (a != 0) {
                  A= bmp180.altitude(P,PresionNivelMar);
                 }
              }
           }
       }
Serial.print("Temperatura: ");
  Serial.print(T);
  Serial.print(" °C , ");
  Serial.println();
  Serial.print("Presion: ");
  Serial.print(P);
  Serial.print(" mb");
  Serial.println();
  Serial.print("Altitud: ");
  Serial.print(A);
  Serial.print(" m s.n.m.");
  Serial.println();
int uvLevel = averageAnalogRead(UVOUT);
  int refLevel = averageAnalogRead(REF_3V3);
  float outputVoltage = 3.3 / refLevel * uvLevel;
  float uvIntensity = mapfloat(outputVoltage, 0.99, 2.8, 0.0, 15.0);
Serial.print("Output: ");
  Serial.print(refLevel);
  Serial.print(" v");
  Serial.println();
  Serial.print("ML8511 output: ");
  Serial.print(uvLevel);
  Serial.print(" v");
  Serial.println();
  Serial.print("ML8511 voltage: ");
  Serial.print(outputVoltage);
  Serial.print(" v");
  Serial.println();
  Serial.print("UV Intensity (mW/cm^2): ");
  Serial.print(uvIntensity);
  Serial.println();
  Serial.print("MQ135 RZero: ");
  Serial.print(rzero);
  Serial.println();
  Serial.print("Corregido RZero: ");
  Serial.print(correctedRZero);
  Serial.println();
  Serial.print("Resistance: ");
  Serial.print(resistance);
  Serial.println();
  Serial.print("Corregido Resistencia: ");
  Serial.print(correctedresistence);
  Serial.println();
  Serial.print("PPM: ");
  Serial.print(ppm);
  Serial.println();
  Serial.print("Corregido PPM: ");
  Serial.print(correctedPPM);
  Serial.println("ppm");
  Serial.println();
escribir(14,40,1,"ILI9341_GREEN","Temperatura");
  escribir(14,60,0.6,"ILI9341_RED",String(t));
  escribir(14,60,0.6,"ILI9341_RED","°C");
  escribir(14,80,1,"ILI9341_GREEN","Humedad");
  escribir(14,100,0.6,"ILI9341_BLUE",String(h));
  escribir(14,100,0.6,"ILI9341_BLUE","%RH");
  escribir(14,120,1,"ILI9341_GREEN","Presión");
  escribir(14,140,0.6,"ILI9341_LIGHTGREY",String(P));
  escribir(14,140,0.6,"ILI9341_LIGHTGREY","psi");
  escribir(14,160,1,"ILI9341_GREEN","Calidad del Aire");
  escribir(14,180,0.6,"ILI9341_CYAN",String(correctedPPM));
  escribir(14,180,0.6,"ILI9341_CYAN","ppm");
  escribir(14,200,1,"ILI9341_GREEN","Radiación UV");
  escribir(14,220,0.6,"ILI9341_MAGENTA",String(uvIntensity));
  escribir(14,220,0.6,"ILI9341_MAGENTA","mW/cm^2");
}
int averageAnalogRead(int pinToRead) {
  byte numberOfReadings = 8;
  unsigned int runningValue = 0;
  for(int x = 0 ; x < numberOfReadings ; x++)
          runningValue += analogRead(pinToRead);
          runningValue /= numberOfReadings;
    return(runningValue);
}
float mapfloat(float x, float in_min, float in_max, float out_min, float out_max) {
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
void escribir(int X,int Y, int tam, short color, String mensaje){
  tft.setCursor(X,Y);
  tft.setTextSize(tam);
  tft.setTextColor(color);
  tft.print(mensaje);
}
Also I adds a little screen.
I make this:

Sorry for the size, the original image was too heavy to upload, in addition to the disorder.
I bought on: naylampmechatronics.com .
And I used his information.
And I read a bit of adafruit.com

In your fritzing drawing, use color coding with red=+, black=- and others when appropriate. Just using blue is to hard to figure out for me so I don't.

Some solderless breadbord have the power rail slit into two parts, left side and right side, check if that is the case.

i don't see the resistor for your raw DHT11.

Do you think it might help instead of just saying "I can't find the errors" to actually tell us what it does that is wrong or what errors you see?  Are we supposed to look at this and guess what it does and guess what you wanted it to do?

@MatsK I'm sorry for that.

@MatsK I tried to prove other form to connect the sensors.

@Delta_G I'm sorry but I tried to told I can't find the errors with the connections and the program because its doesn't work correct. Also I'm a beginner.

But you can tell us what are the symptoms right?  Look, you have some code and it does something.  You want it to do something else.  How can we help you if we don't know what those two things are?  You can draw a better schematic can't you?  There's lot you can do without knowing the exact error in your code to help us help you.  Something like, "I expect the light to come on when I press the button but it doesn't."  Does that make sense?

@dandavis My dht11 have a little board-controller with which I only connect direct.

@Delta_G sorry again, the dht11 sensor does not send data, the sensor bmp180 if it measures the pressure, but to correct it uses the dht11, so it does not correct, besides the ML8511 gives erroneous data, the mq135 if it works well but also corrects with the dht11, so it does not work well when corrected.

@Delta_G  I will make a new fritzing drawing.

OK.  Still waiting on that schematic.  Did you notice the comment by @dandavis?  Sounds like your main issue is with the dht11 and he spotted an issue with that.  Do you think you should address that issue?

NOT FRITZING.  They're impossible to decipher.  Just draw a schematic.

@Delta_G Yes, because I cannot see my errors. Fritzing I only use how place to draw the connections.

@Delta_G I have to changed a little of the post. Thanks for your tips.

Fritzing is the only way you know?  You don't know how to use a pencil and paper?

@Delta_G Jajajajaja, I have left all my materials at school.

The method for troubleshooting is: 1. Disconnect everything. 2. Add one sensor. 3. Verify if the sensor works. 4. If it works repeat step 2 for next sensor. 5 If it doesn't work, why? is it the connections correct?

The method for troubleshooting is:

Disconnect everything.
Add one sensor.
Verify if the sensor works.
If it works repeat step 2 for next sensor.
If it doesn't work, why? is it the connections correct?


text:
Select from Custom Array without Repeat
I found this great code to pick a random number from a "hat" without repeat:
/* RandomHat
  Paul Badger 2007 - updated for Teensy compile 2017
  choose one from a hat of n consecutive choices each time through loop
  Choose each number exactly once before reseting and choosing again
*/

#define randomHatStartNum 0  // starting number in hat
#define randomHatEndNum 25    // ending number in hat - end has to be larger than start
#define numberInHat (randomHatEndNum - randomHatStartNum) + 1

void setup()
{
  Serial.begin(9600);
  Serial.println("start ");
}

void loop()
{ // randomHat test
  for (int i = 1; i <= numberInHat; i++) {
    int x = randomHat();
    Serial.print(x);
    Serial.print(", ");
    delay(50);
  }
  Serial.println(" ");
}

int randomHat() {
  int thePick;    //this is the return variable with the random number from the pool
  int theIndex;
  static int currentNumInHat = 0;
  static int randArray[numberInHat];

  if  (currentNumInHat == 0) {                  // hat is emply - all have been choosen - fill up array again
    for (int i = 0 ; i < numberInHat; i++) {    // Put 1 TO numberInHat in array - starting at address 0.
      if (randomHatStartNum < randomHatEndNum) {
        randArray[i] = randomHatStartNum + i;
      }
    }
    currentNumInHat = abs(randomHatEndNum - randomHatStartNum) + 1;   // reset current Number in Hat
    Serial.print(" hat is empty ");
    // if something should happen when the hat is empty do it here
  }

  theIndex = random(currentNumInHat);                  //choose a random index from number in hat
  thePick = randArray[theIndex];
  randArray[theIndex] =  randArray[currentNumInHat - 1]; // copy the last element in the array into the the empty slot
  //                                                     // as the the draw is random this works fine, and is faster
  //                                                     // the previous version. - from a reader suggestion on this page
  currentNumInHat--;    // decrement number in hat
  return thePick;
}

I would like to use a custom array to choose from like so:
char *things[]={
"Thing 1",
"Thing 2",
"Thing 3",
"Thing 4",
"Thing 5",
"Thing 6",
};

Which is quite possible as I use the numbers from to first piece of code to select items from my custom array.
So I have two questions about this:
The first being the code first returns "hat is empty" before the numbers.
start
  hat is empty 11, 24, 17, .......
  hat is empty 4, 19, 23, .......

Is there a way to reverse this?
And secondly, I would like define the randomHatEndNum automatic by the lenght of my custom array, but I have trouble implementing that code. What is the right way to approach this?

The first being the code first returns "hat is empty" before the
  numbers.

Well, you have to comment out the line
Serial.print(" hat is empty ");

I would like define the randomHatEndNum automatic by the lenght of my
  custom array,

To get the size of an array, the standard idiom is
const int numberInHat = sizeof(things) / sizeof(things[0]);

I rewrote your sketch.
The idea is use randArray to store all the remaining values to return. Then, randomly pick one value (to return) and replace randArray with -1, which signal that the value has been returned, so don't return it again.
The best for functions returning random values is always work in the range 0..n, and adjust that value in the calling code if you need some other range (like 1..n+1). It's simplier and simplify debugging.
/* RandomHat
  Paul Badger 2007 - updated for Teensy compile 2017
  choose one from a hat of n consecutive choices each time through loop
  Choose each number exactly once before reseting and choosing again
*/

char *things[]={
"Thing 0",
"Thing 1",
"Thing 2",
"Thing 3",
"Thing 4",
"Thing 5",
"Thing 6",
};

const int numberInHat = sizeof(things) / sizeof(things[0]);

void setup()
{
  Serial.begin(9600);
  while(!Serial);
}

void loop()
{ // randomHat test
  for (int i = 0; i < numberInHat; i++) {
    int x = randomHat();
    Serial.print(x); Serial.print(" ");
    Serial.println(things[x]);
    delay(50);
  }
  Serial.println("----");
}

int randomHat() {
  int thePick = -1;    //this is the return variable with the random number from the pool
  int theIndex;
  static int left = 0;
  static int randArray[numberInHat];

  if  (left == 0) {                                // hat is emply - all have been choosen - fill up array again
    for (int i = 0 ; i < numberInHat; i++) {    // Put {0, ..., n} into randArray.
        randArray[i] = i;
      }
    left = numberInHat;
  }

  // bEmpty always false at this point.
  while (thePick == -1) {
    theIndex = random(numberInHat);                  //choose a random index from number in hat
    thePick = randArray[theIndex];
   }

  left--;
  randArray[theIndex] =  -1;        // value theIndex is not longer available.
  return thePick;
}


text:
Detect if a 3 phase AC submersible pump is on
I need to know when a 3 phase AC submersible pump is turned on, for the sake of logging it to a online database. Thing is, I do not know how tell if it is ON, or OFF. I've given a thought to using a current transformer, specifically the "STC-013-30" one, but it requires to be wrapped around one of the AC wires (live/neutral) but the motor i have has both the wires insulated together forming a single, huge wire. Plus, its 3 phase, and I do now know if the STC can detect 3 phase currents. Can it be done some way? Can I utilise some other tool to tell if the motor is ON?

Well, you're just going to have to separate out those wires then aren't you?

The surprising sensor that tells me my furnace is running? a microphone. unless you have a silent pump (dream on), a mic taped to the housing should work a treat. if you needed measurements, it's complicated, but telling it's merely "on"? An adjustable cheap mic module w/opamp and pot is fine.

It's likely that the power to the motor is originating at a panel with breakers. You should be able to confirm that only one breaker set is being used to power the pump motor. At that location, all the wires are separated.
If you do not have the necessary skill to identify the correct wires, consider to consult an electrician. It is advisable to remove power to the panel before you begin to insert your fingers to wrap the sensor wire around the correct lead.

I'm afraid I'm not allowed to split the wires. I'm to alter nothing. It's a shame the current transformer is useless when the live and neutral wires are wrapped around each other.

It seems likely, based on the other comments, that the electrical method is not suited for your purpose. I suggest that water flowing through a pipe is not silent. Using a sensitive microphone on the pipe nearest the pump would provide an on/off level trigger. Credit to dandavis for his suggestion.

The long and short of it is that you need to measure the current. And there's two basic methods of doing that, and both require access to just one of the wires in the cable.
So you will either have to take a knife to your cable and carefully remove a section of the outer insulation to access the wires within it, or create some kind of adaptor cable that the existing cable plugs into (however that is done on your system) to allow access to the individual wires.
Then it's a case of either:

Use the magnetic field of one wire to monitor the current (current transformer) or
Introduce a shunt resistance into the current path and measure the voltage drop across it.

The first option is by far the safest.
Alternatively there may well be some form of commercial three-phase power monitor with an output that you can monitor to achieve what you want with less danger of electrocuting yourself and others in the process.

thanks, but I cannot split the wires.

Then you will either have to build an adaptor for it to plug into (if there is even a plug - but who knows round here except you...?) or do something else further up the electrical chain.

Ok, thank you. Any way you think I could accomplish it by checking if the water's flowing through the pump's pipe?

If you can break into (cut) the pipe and add a suitable flow meter, sure.

Oops like I said, I cannot alter the existing. I mean, not so much as CUTTING open anything. Anyway, thank you.

So you need a 100% non-intrusive method to see if the pump is running. That only really leaves sound or vibration then - is the pump making a noise, or is it vibrating. Since it's submerged that's tricky to do...

the pump hardly makes noise, and yes its submerged. so, cannot attach and vibration sensors to it.

Well you're a bit stuffed then...


text:
multiple definition of local variable in linking
I am trying to make my own library and it uses some local variables with the same name as some variables in ino. Compiler complains about it. I stripped it to (nonsence but simple) example
mylib.h:
#ifndef MYLIB_H
#define MYLIB_H
int doit();
#endif

mylib.cpp:
#include "mylib.h"
int value;
int doit(){
    return value++;
}

example.ino:
#include "mylib.h"
int value;
void setup(){
    value=3;
    pinMode(13,OUTPUT);

}
void loop() {
    digitalWrite(13,(value==doit()) );
}

compiling:
$ make
/usr/bin/avr-gcc -Os -Wl,--gc-sections -mmcu=atmega328p example.o mylib.o .lib/arduino.a -lm -o example.elf
mylib.o:(.bss.value+0x0): multiple definition of `value'
example.o:(.bss.value+0x0): first defined here
collect2: error: ld returned 1 exit status
/home/gilhad/GIT/HW/Arduino/minipro//../Arduino.mk:436: recipe for target 'example.elf' failed
make: *** [example.elf] Error 1

I am not usint the value in the .h file, so why it collides with similary named variable from another module?
Should not be it private to the module until exposed via .h file?

Try the keyword "static". https://stackoverflow.com/questions/572547/what-does-static-mean

Thank you, it completly explains my question (and some more). If you make it answer, I would accept + upvoted it, as it provided good inside for me to the whole problem :)

@MikaelPatel, can you explain why this works?  From my perspective, gihad should subscribe to creating Arduino libraries using C++ (not just C) and create a class where the library's private variables would be protected (not even seen) from the Arduino sketch.

As a fact of matter, it was not even my code, but my 13-years old nephew's. And he was trying to separate few common used functions (many of which had nothing common) away for his playing with some LEDs and displays, to use it in more versions of the same program (Hello world, Hello city and such). And few of that functions shared some settings (LedOn, Color, Value).

And it did not compile, so he asked me, why and I did not know. I would wrote it in totally different way and I would not hit such problem, but I could not find, why it is not working. And say "do it much complicated way and do not even ask why it does not work this way" is not good approach in teaching. Also it signalled, that I do not know something, which I should know.  And I am planning to write much complicated projects, so I want to know not only how make things nice, but also how it works under hooks when I want to poke really deep :)

I am not usint the value in the .h file, so why it collides with similary named variable from another module?
Should not be it private to the module until exposed via .h file?

The quick answer is that a source code file is not a separate unit. The last step in the build process is to link all the object file and create the executable binary. The linker will need to resolve all the symbols. In this case there are two definitions and the compiler cannot resolve the references. The linker can be told to ignore multiple definitions.
The keyword "static" will make the symbol local to the compiled unit (object file). As the keyword "external" tells the compiler that the definition is in another compiled unit. Header files is just a structuring convention. The language does not actually say anything about this. It is a pre-processor (cpp) in the build process that creates the combined source code for the compiler.
C++ (and OOP) adds a number of ways to control the visibility of symbols (aka encapsulation). In a class definition the keywords "public", "protected" and "private" may be used. Also the keyword "static" may be used. In this case it means that the symbol is defined globally for the class (class variable) and not per instance (member variable).
The keyword "static" in C/C++ is actually a "recent" development of the languages. In the early versions of C local symbols where prefixed with underscore "_local". This is still a common practice even though the object files contain much more scope information today.
Cheers!

The common practice is to write Arduino libraries using C++ classes:

The core of the header file consists of a line for each function in
  the library, wrapped up in a class along with any variables you need.

class Morse
{
  public:
    Morse(int pin);
    void dot();
    void dash();
  private:
    int _pin;
};

In this way you can specify what is private (variables and methods only seen within the class) and what is public (variables and methods that can be seen outside the class).  In the given example, the variable called "_pin" is private to the class Morse.
In your case, you would want to make a private class variable called "value".  Because it is private, you are free to re-use the name when not inside the class.


text:
Arduino Leonardo keyboard
I use Arduino Leonardo board for virtual keyboard. Everything work fine, but when my local keyboard layout is russian it's not work how I want. This is my code
Keyboard.print("cmd");
typeKey(KEY_RETURN);
delay(2000);
Keyboard.print("powershell iwr -outf %TEMP%\\index.html http://google.com");
typeKey(KEY_RETURN);

Otput in English US keyboard layout:
cmd
powershell iwr -outf %TEMP%\index.html http://google.com

Output in Russian keyboard layout
сьв
зщцукырудд шцк -щгеа %ЕУЬЗ%\штвучюреьд реезЖ..пщщпдуюсщь

Is there a way to make Arduino Leonardo to write every time in English US keyboard layout no matter what keyboard layout uses my computer?

This is not really an Arduino question.  This is a Windows operating systems question about switching between keyboard layouts.  Should be close this question?  Or ask to have it moved to a more appropriate forum?

The Arduino Leonardo, in the same way as any keyboard, just sends keystroke data. It is down to your computer's operating system to translate those into individual letters and symbols. The Leonardo (and indeed any keyboard) has no say over how the operating system does that translation.
A brief google search (which led back to Stack Exchange) found me this project which may be of some interest. It allows you to automatically change the selected keyboard language depending on which keyboard is being used at any one moment in time.

But how to add this in Arduino Leonardo ?

You didn't quite grasp what I said, did you? It's down to your operating system which is windows, and that is where you have to do everything.

I understand you. But if I want to test arduino leonardo keyboard on different pc with russian layout I have to download this and use them. I want  to configure Arduino to send keystrokes everytime in US layout in every pc no matter which keyboard layout they uses.

@Desole you don't send keystrokes in any layout. You send keystrokes that, to a certain extent, describe the physical location of the key on they keyboard. There is no language. Only a location. Only the operating system can convert that location to a character. There is nothing you can do from the Arduino. No matter how much you beg and moan.

Think about it: if the keyboard could define the layout why would the operating system even have the ability to select a layout? It'd be pointless. Keycodes do not equate to characters directly. True, a Unicode keyboard is technically possible, but no operating system supports such a thing because there is no standard for it.


text:
Power Arduino with 12V while using Serial Communication over USB
I'm going to build a 8x8x8 Led RGB Cube, therefore I will need a lot of Power which the arduino can't handle, so I'm using a 12V 20A (I know 20A isn't necessary but I had one laying around).
So the question is, is it possible to power the arduino over the Vin Pin with the 12V and program / communicate over serial connection in the same time? Like a real time programmed RGB LED Cube.

simulate this circuit – Schematic created using CircuitLab

What kind of LED's require 12V?

How to power an Arduino
Arduino can manage multiple power inputs at the same time while fully operational (incluide Serial - USB connection to the PC).

JAPAN JACK socket: an external source (a power supply, usually) must be connected to this socket, with the positive pole going to the central part of the jack, and the value must be ranging between 6 V and 20 V, even though the range recommended by the manufacturer is 7÷12 V, thus it is not advisable to use voltages that are lower than 7 V or greater than 12 V, if not in the case of a real need; 6 V may not guarantee a proper stabilization on the part of the regulator, it is in fact needed to consider the voltage fall of the protection diode, placed in series at the regulator’s input (whose purpose is to preserve the board from destruction in the case of polarity inversion on the jack); while values above 12 V would create an excessively high drop-out (an electric potential difference between the regulator’s input and output) that would cause a pointless overheating of the regulator, even with low levels of current draw.

I'm now starting to doubt what I though about Arduinos.
If you are using a 12V PSU to power the Arduino, you are only going to get 5V out of the vOut pin.  The 20Amps you are supplying isn't going to come out either, all you'll get is ~300mA from the vOut or ~20mA from the digital pins. This is because of all the regulators.
If you want to get the Arduino to switch LEDs on and off from another source you are going to need transistors.  This will let you switch different voltages and higher currents.


text:
How do I know the size of the bootloader of ATtiny? Is it the same as ATMega328P?
I burned the bootloader in ATtiny45 with the Arduino tool.

I want to know how much memory it has taken.
Is this bootloader the same code of a bootloader used in the 328P or other chips?
Can I see this code in any way, to know how it works?

no, it's not the same bootloader. well, a tiny part of it might be, read up on bootloaders.

What bootloader? Please edit your question to post a link to where you got this "bootloader" from.

1) I want to know how much memory it has taken

Look to see how big the bootloader is. If it's a HEX file you will either want to load it into a HEX (Intel HEX, not hexadecimal representation) file editor, or convert it to binary with avr-objcopy.
$ avr-objcopy -I ihex <hex file> -O binary <bin file>

2) and if this bootloader is the same code of a bootloader used in the 328P or other chips

No, each chip requires its own special bootloader - simply because all chips are different: that's why they exist.  If they were all the same there would only be one chip.

3) Can I see this code in any way, to know how it works ?

If it's open source and you download the bootloader from wherever it's stored (probably Github somewhere), then yes, you can. Of course, that also assumes that you would understand what you are seeing which, judging by this question, is not that likely.

The '45 doesn't have an actual UART so I suspect that the "bootloader" is just a stub that allows the IDE to set the fuses properly.

Or... it uses software serial, or it uses software USB (as the digisparks do on the '85).


text:
Cannot start Arduino IDE after playing with several versions of it
On my Linux Mint 17 Quiana I have manually downloaded and ran several versions of the arduino IDE (1.05 which is in the repo, 1.6.x for some time, now 1.8.3). Things worked like a charm.
Now I am trying to get the IDE 1.8.5 going, but I cannot get the IDE started. Started means: I download, extract the files to a directory and run the install.sh command such that the desktop icon gets created. This finishe with a success message. Now I am clicking on the desktop icon, but nothing happens.
Need to say that the IDE 1.05 which comes as a package with Qiana works just fine. I have run the install.sh of both to and fro, but only the 1.05 will start properly. I checked on the desktop link, the execution rights, user, group etc. They are all looking fine for 1.8.5 but it wont start.
I tried to start the 1.85 arduino IDE from the command line - hoping to get some clue from error messages:
java -DAPP_DIR=/opt/arduino-1.8.5/ Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel processing.app.Base

--> running this it tells me, that the main class cannot be found.
Any hints where I am going wrong? Are there any config files to be cleared up, paths to be set ...?

You do not need to install Arduino at all. In fact I have never had it work right due to things not being found.
All you need to do is, from a terminal, run the arduino command in the extracted directory:
fred@computer:~/arduino-1.8.5 $ ./arduino

Any errors that then throws will be a clue as to why it doesn't want to work.

Hi there
thanks for replying. I found the issue based on the idea to call arduino from the command line as proposed by you. Stupid me had downloaded the 64bit version but am still running on a 32bit kernel. I now got the 32 bit IDE and it works like a charm.
The problem was so weird - it had to be something stupid :-/
Best
Al

1.05 is the latest available packaged version (and is quite dated).
You can download and (optionally) install the new version. See Installing Arduino IDE on Linux
Either remove (or ignore) the old version. Apart from the additional support the new version supplies, the directories differ - you can either change to the new (recommended) or change the settings.
There is no NEED to "install" the new version. The supplied script DOES NOT install in the traditional sense, it merely installs GUI links to the download.


text:
Could someone explain this code that sets up the software serial port data rate?
I understand most of it. The part I don't understand is the is the code in for void loop. How does that set the data rate for the software serial port? I thought mySerial.begin(9600) did that? Please help.
#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); // RX, TX

void setup()
{
    // Open serial communications and wait for port to open:
    Serial.begin(9600);
    while (!Serial) {
        ; // wait for serial port to connect. Needed for Leonardo only
    }

    Serial.println("Goodnight moon!");

    // set the data rate for the SoftwareSerial port
    mySerial.begin(9600);
    // set master
    mySerial.print("AT+ROLE1");
    delay(10000);

}

void loop() // run over and over
{

    // set the data rate for the SoftwareSerial port
    mySerial.print("test I am master  ");
    delay(10000);
    ***if (mySerial.available())
    Serial.write(mySerial.read());
    if (Serial.available())
    mySerial.write(Serial.read());***
}

it is just a wrong placed comment :-)

are you asking about the code highlighted with ***?

You're confusing "data rate" with "baud rate".
The baud rate is the speed at which bytes are transmitted over the wires, and is set with mySerial.begin(9600);.
The data rate is the speed at which data is sent over the serial port, and that is set by the delay(10000); which dictates how often "test I am master  " is sent and any incoming data is checked for and echoed.

The void loop
while(!Serial) {
;
}

simply wait for the serial port to be ready to transmite/receive data. Otherwise, your first Serial.print will be lost.
You can omit it if you don't plan to transmit anything during the first second or two in your sketch.


text:
Multiple random Fire2012 sequence in same strip
I am trying to simulate 4 flickering flames on a single LED strip.
The ws2812b strip has 60 LEDs. I cut and chained it into 4 chunks of 15 LEDs. Each chunk has a random Fire2012 sequence, however the entire sequence seems to start and stop at the same time, and therefore they all look extremely similar.
What is the best way to overlap the fire sequences so that timing looks different for each chunk?
Here is my code so far...
#include <FastLED.h>

#define LED_PIN     5
#define COLOR_ORDER GRB
#define CHIPSET     WS2812B

#define NUM_CHUNKS           4
#define NUM_LEDS_PER_CHUNK   15
#define NUM_LEDS NUM_CHUNKS * NUM_LEDS_PER_CHUNK

#define BRIGHTNESS  80
#define FRAMES_PER_SECOND  30

#define gReverseDirection false

CRGB leds[NUM_LEDS];

void setup() {
  delay(3000); // sanity delay
  FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.setBrightness( BRIGHTNESS );
}

void loop()
{
  // Add entropy to random number generator; we use a lot of it.
  // random16_add_entropy( random());

  // Get LED Chunks
  for(int i = 0; i < NUM_CHUNKS; i++){
    //random16_add_entropy( random());
    Fire2012(i); // run simulation frame
  }

  FastLED.show(); // display this frame
  FastLED.delay(1000 / FRAMES_PER_SECOND);
}

// Fire2012 by Mark Kriegsman, July 2012
// as part of "Five Elements" shown here: http://youtu.be/knWiGsmgycY
////
// This basic one-dimensional 'fire' simulation works roughly as follows:
// There's a underlying array of 'heat' cells, that model the temperature
// at each point along the line.  Every cycle through the simulation,
// four steps are performed:
//  1) All cells cool down a little bit, losing heat to the air
//  2) The heat from each cell drifts 'up' and diffuses a little
//  3) Sometimes randomly new 'sparks' of heat are added at the bottom
//  4) The heat from each cell is rendered as a color into the leds array
//     The heat-to-color mapping uses a black-body radiation approximation.
//
// Temperature is in arbitrary units from 0 (cold black) to 255 (white hot).
//
// This simulation scales it self a bit depending on NUM_LEDS; it should look
// "OK" on anywhere from 20 to 100 LEDs without too much tweaking.
//
// I recommend running this simulation at anywhere from 30-100 frames per second,
// meaning an interframe delay of about 10-35 milliseconds.
//
// Looks best on a high-density LED setup (60+ pixels/meter).
//
//
// There are two main parameters you can play with to control the look and
// feel of your fire: COOLING (used in step 1 above), and SPARKING (used
// in step 3 above).
//
// COOLING: How much does the air cool as it rises?
// Less cooling = taller flames.  More cooling = shorter flames.
// Default 50, suggested range 20-100
#define COOLING  55

// SPARKING: What chance (out of 255) is there that a new spark will be lit?
// Higher chance = more roaring fire.  Lower chance = more flickery fire.
// Default 120, suggested range 50-200.
#define SPARKING 60

void Fire2012(int chunk)
{
// Array of temperature readings at each simulation cell
  static byte heat[NUM_LEDS_PER_CHUNK];

  int startLed = NUM_LEDS_PER_CHUNK * chunk;
  int endLed = NUM_LEDS_PER_CHUNK * chunk + NUM_LEDS_PER_CHUNK;

  // Step 1.  Cool down every cell a little
    for( int i = 0; i < NUM_LEDS_PER_CHUNK; i++) {
      heat[i] = qsub8( heat[i],  random8(0, ((COOLING * 10) / NUM_LEDS_PER_CHUNK) + 2));
    }

    // Step 2.  Heat from each cell drifts 'up' and diffuses a little
    for( int k= NUM_LEDS_PER_CHUNK - 1; k >= 2; k--) {
      heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;
    }

    // Step 3.  Randomly ignite new 'sparks' of heat near the bottom

    if( random8() < SPARKING ) {
      int y = random8(7);
      heat[y] = qadd8( heat[y], random8(160,255) );
    }

    // Step 4.  Map from heat cells to LED colors
    for( int j = 0; j < NUM_LEDS_PER_CHUNK; j++) {
      CRGB color = HeatColor( heat[j]);
      int pixelnumber;
      if(gReverseDirection) {
        pixelnumber = (endLed - 1) - j;
      } else { //0 15
        pixelnumber = startLed + j;
      }
      leds[pixelnumber] = color;
    }
}

Instead of calling them all back to back like that in the for loop, break them up with a little delay between each one.

https://github.com/darrenpmeyer/Arduino-FireBoard/ is built on the FastLED fire example, but supports configurable width. Could that be a viable alternative?

@MikaelFalkvidd that might provide the effect I am looking for, however I would like to know how to accomplish it by way of setting up the loop and delay correctly.

#include <FastLED.h>

 #define LED_PIN     5
 #define COLOR_ORDER GRB
 #define CHIPSET     WS2811
 #define NUM_LEDS    (kMatrixWidth * kMatrixHeight)
 #define FRAMES_PER_SECOND 60
 //////////////////////////////////////////////////////
 const uint8_t kMatrixWidth  = 15;
 const uint8_t kMatrixHeight = 4;
 const bool    kMatrixSerpentineLayout = true;
 //////////////////
 int BRIGHTNESS = 250;

//////////////////////////////////////////////////
bool gReverseDirection = false;

CRGB leds[NUM_LEDS];

void setup() {
Serial.begin(115200);
Serial.println("*** Inicialization");
///////////////////////////////////////////////
delay(3000); // sanity delay
FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS);
FastLED.setBrightness( BRIGHTNESS );
}
/////////////////////////////////// end setup

void loop()
{

 Fire2012();
 FastLED.show(); // display this frame
 FastLED.delay(1000 / FRAMES_PER_SECOND);
 FastLED.setBrightness( BRIGHTNESS );
 }

 void Fire2012()
 {
  int COOLING = 90;
  int SPARKING = 100;
   // Array of temperature readings at each simulation cell

    static byte heat[kMatrixWidth] [kMatrixHeight];

    // Step 1.  Cool down every cell a little
    for (int n = 0; n< kMatrixHeight; n++)
   {

     for ( int i = 0; i < kMatrixWidth; i++) {
       heat[i][n] = qsub8( heat[i][n],  random8(0,
       ((COOLING * 10) / (kMatrixWidth)) + 2));
       }

       // Step 2.
      for ( int k = (kMatrixWidth- 1); k >= 2; k--) {
      heat[k][n] = (heat[k - 1][n] + heat[k - 2][n] +
      heat[k - 2][n] ) / 3;
      }

       // Step 3.
      if ( random8() < SPARKING ) {
       int y = random8(3);
       heat[y][n] = qadd8( heat[y][n], random8(160, 255) );
      }
     }

  // Step 4.  Map from heat cells to LED colors

for ( int i= 0; i < kMatrixWidth; i++) {
  for (int j = 0; j < kMatrixHeight; j++) {

    CRGB color = HeatColor(heat[i][j]);
    leds[XY(i, j)] = color;

     }
   }

 }

   /////////////
    uint16_t XY( uint8_t x, uint8_t y)
    {
    uint16_t i;
    if ( kMatrixSerpentineLayout == false) {
    i = (y * kMatrixWidth) + x;
    }
    if ( kMatrixSerpentineLayout == true) {
    if ( y & 0x01) {
     // Odd rows run backwards
     uint8_t reverseX = (kMatrixWidth - 1) - x;
     i = (y * kMatrixWidth) + reverseX;
     } else {
    // Even rows run forwards
      i = (y * kMatrixWidth) + x;
     }
    }

    return i;

   }/////

I've adjusted the lights to be WS2812B and it works as expected

Instead of calling the function on all 3 chunks back to back in the for loop and then only doing show() after you've updated all three chunks, break it up a little and put a little delay between them.
    byte i = 0;

    void loop(){
       Fire2012(i);
       FastLED.show();
       FastLED.delay(1000 / NUM_CHUNKS / FRAMES_PER_SECOND);
       i = (i + 1) % NUM_CHUNKS;
    }

You could even make the delay a little bit random if you wanted to.

right. I was considering this. I wasn't quite sure how to ensure the first show would exceed the delay so that it would overlap then next loops show. I'll give this a go.

@delta-g  unfortunately it has the same effect.


text:
Pin change interrupt does not work properly to wake up arduino from sleep mode
I am building a timer circuit using Arduino Pro Mini Atmega168p 5v 16MHz (which later supposed to be become to adjustable one).
Here is the current breadboard view.

(I am supposed to use SS relay at place of that green thing. I am not sure if that item is correct SS relay in Fritzing)
Here is the program code I wrote.
#include <PinChangeInterrupt.h>
#include <PinChangeInterruptBoards.h>
#include <PinChangeInterruptPins.h>
#include <PinChangeInterruptSettings.h>

#include <avr/sleep.h>

// LED to indicate timer is active.
const int ON_LED = 5;
// It should be high when timer is active.
// Connect to relay.
const int PUMP_SWITCH = 6;

// Button to start timer running.
const int START_BUTTON = 8;
// Button to stop timer forcefully.
const int STOP_BUTTON = 9;

volatile boolean timer_running;
volatile int timer_start_time;

// TODO: Make it volatile once timer has mdified as configurable.
volatile unsigned long timer_time = 0;

void enter_sleep_mode() {
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  sleep_enable();
  sei();
  sleep_mode();
}

/**
 * Activate timer.
 */
void start_timer() {
  if (!timer_running) {
    // Time period in milliseconds.
    timer_time = 30000ul; // 30 seconds

    timer_running = true;
    timer_start_time = millis();
  }
}

/**
 * Stop timer.
 */
void stop_timer() {
  timer_running = false;
  timer_start_time = 0;
}

void setup() {
  timer_running = false;
  timer_start_time = 0;

  // Configure output pins.
  pinMode(ON_LED, OUTPUT);
  pinMode(PUMP_SWITCH, OUTPUT);

  // Configure pins for input push buttons.
  pinMode(START_BUTTON, INPUT_PULLUP);
  pinMode(STOP_BUTTON, INPUT_PULLUP);

  // Attach interrupt handlers
  // Buttons are with pull up resistors so listening for 'falling' (voltage).
  attachPCINT(digitalPinToPCINT(START_BUTTON), start_timer, FALLING);
  attachPCINT(digitalPinToPCINT(STOP_BUTTON), stop_timer, FALLING);
}

void loop() {
  if (timer_running) {
    digitalWrite(ON_LED, HIGH);
    digitalWrite(PUMP_SWITCH, HIGH);
    // TODO: Handle the case when return value of millis() goes back to start from zero
    if ( (millis() - timer_start_time) >= timer_time ) {
      // Timer elapsed the required time period.
      // So, stop the timer.
      stop_timer();
    }
  }
  else {
    digitalWrite(ON_LED, LOW);
    digitalWrite(PUMP_SWITCH, LOW);
    // Nothing to do If timer is not running.
    // Save power!!
    enter_sleep_mode();

    sleep_disable();
  }
}

The problem is timer does not work when pressing START button starting from third click. Two initial clicks works OK and timer functions as it should be. I think it does not wake up properly from sleep mode. However, wondering why it works for two initial clicks??
Please help me to identify the problem.
I don't have much experience in writing Arduino code.
Thanks

Start by checking your calculation of time limits. I see you are mixing signed and unsigned arithmetics - not a very good idea. Check the blink-without-delay example for how to do that.

@MikaelPatel That is great! You are right. I found my mistake. I was wrongly declaring volatile int timer_start_time; where timer_start_time variable is supposed to hold return value from millis()
Now I declared it as volatile unsigned long timer_start_time; and it worked! :)
Could you please make it an answer so I can select?
Thanks

Start by checking your calculation of time limits. I see you are mixing signed and unsigned arithmetics - not a very good idea. Check the blink-without-delay example for how to do that.
The declaration of timer_start_time should be paid special attention.
Good luck with your project!

I could identify my problem and fixed it by declaring timer_start_time and   as unsigned long. It should be wide enough to hold return values from millis(). Thanks!

Please help me to identify the problem.

it is always very easy to solve this type of problems, if you just follow some common sense.
1) decompose your functionality  into manageable blocks. for example, one is PCINT - can you blink an led with it - and another is going into sleep - can you put the mcu into sleep - and the next is to walk up from sleep - does your mcu support that? what has to be true for that to happen? ...
2) test individual blocks on their own.
3) integrate them into one functional program.
don't co-mingle them day 1. tackle only what you can manage. no more and no less.


text:
Arduino Pong game Circuit Board Troubleshoot
I am following a tutorial online to make a pong game. I have managed to make quiet a lot work apart from my paddles in the game keep on shaking. The buttons do work fine, up and down on both ends.
Tutorial Link
I am sure, there is something with the power being supplied and not reaching to all points in the breadboard.
I am attaching a picture of my circuit board. Any advice?
Thank you,
W

The + and - along the bottom of the picture aren't connected to anything.
It also looks like this board has a separate left and right side.
So just make sure everything is connected along the sides.

Do you mean, I should supply the + & - from top side to the bottom?

No. They are split horizonally, in the middle. Both rails, upper and lower. Test continue with an ohmmeter and see yourself


text:
Using an IR sensor from another manufacturer
I am currently trying to create a line tracing robot with my Arduino Uno.
I have an IR Sensor (http://support.robotis.com/en/product/auxdevice/sensor/irsensor_manual.htm) but I am not sure if I can use this for my Arduino.
Can someone please tell me if I can? Thanks in advance.

You can use anything you can write code for.

Please, accept @DeanFranks answer to close your question.

Yes, you will need to connect the sensor ADC line to an ADC input on the Arduino and calculate the range from the analogread result.  You should be able to use one of the Sharp sensor libraries, although you may need to apply a correction factor to the distance results.

Would the ADC input be the analog in bit of the arduino (i.e. A0, A1...)?

You are correct, any of the A# analog pins.