Reading analog pin only showing two values (0 and 1023), no in-between!

ok, other option coud be this (based on ESP8266):

I recommend you to test with another Wifi Shield if possible (from a colleague or family) to see if there is a problem with your particular shield.

Also I recommend you to not use analog sensors if possible, as they are difficult to calibrate and are much more susceptible to noises. I prefer using digital sensors over I2C as you can connect a bunch of them in the same two digital pins, having accurate readings, without requiring any calibration process, etc. So you can use boards that are cheaper and smaller, like an Arduino MKR1000, NodeMCU, etc.

With a small NodeMCU we are reading through I2C temperature, pressure, lux, humidity, etc. using only two pins of the boards.

1 Like

@JorgeTrincado Thanks. I will be getting the ESP8266 based shield. Hopefully it will work perfectly.

@alvarolb I don’t think I’ll be able to get my hands on another shield, but I will try. As for the sensors, they are already setup and streaming. I am just trying to get that done wirelessly.

1 Like

I have got an ESP8266 based WiFi shield but then while trying to figure out the programming needed, I came across this thread.

Here, @alvarolb you mentioned that library for “Arduino + ESP8266 as Wifi bridge” is in development. Are there any updates on that?

Sorry for bugging you too much. I am also trying using CC3000. I am able to connect with the WiFi but not able to establish a connection with error message

[_SOCKET] Connecting to
[_SOCKET] Error while connecting!

Here is the debug code used:

#define _DEBUG_
#include <Adafruit_CC3000.h>
#include <SPI.h>
#include <ccspi.h>
#include <ThingerCC3000.h>

#define USERNAME "your_user_name"
#define DEVICE_ID "your_device_id"
#define DEVICE_CREDENTIAL "your_device_credential"

#define SSID "your_wifi_ssid"
#define SSID_PASSWORD "your_wifi_ssid_password"


    void setup(){

  thing.add_wifi(SSID, SSID_PASSWORD);

    // just the normal analog read
    thing["Value1"] >> analogPin(A0);

    /* define another resource with a small delay before reading
       to check if I/O affects readings in some way.
    thing["Value2"] >> [](pson& out){
      // make a read just after receiving the query
      int value = analogRead(A0);
      // debug just after request value
      Serial.print("Thing read 1: ");
      // add a small delay
      delay(100); // change up and down if there is no difference
      // read analog value again
      value = analogRead(A0);
      // debug new value
      Serial.print("Thing read 2: ");
      out = value; // upload final value

void analogTest(){
  Serial.println("Testing Reads");
  unsigned long currentTs = millis();
    int value = analogRead(A0);

int state = 0;

void loop(){
    // check reads before any call to handle
    // just connect to thinger
    // test analog reads again
    state = 1;
    // normal call to handler

Can you elaborate as to why this would be happening?