LED Breathing White and Spark not connecting to Wifi

Hello,

I was using the spark in Semi Automatic mode
The RGB led used to Breathe Green on connection and everything was working fine.

I tried uploading the same code to the core, and now the core breathes white light and is not connecting to the Wifi.

I tried using the automatic mode and it works fine and the LED breathes Cyan but in Semi Automatic mode, it is not connecting to the Wifi and is breathing White. (This was not happening previously)

What can be the issue?

Following is my code

SYSTEM_MODE(SEMI_AUTOMATIC);


TCPClient client;
byte server[] = { 192, 168, 0, 102 };
byte c;
int port = 5555;
int led = D7;
int motor = A0;
uint8_t distance = 0;
int motorVal = 0;


void setup()
{
  // Make sure your Serial Terminal app is closed before powering your Core
  Serial.begin(9600);
  delay(10000);
  pinMode(led, OUTPUT);
  pinMode(motor, OUTPUT);
  // Now open your Serial Terminal, and hit any key to continue!
  //while(!Serial.available()) SPARK_WLAN_Loop();

  Serial.println("connecting...");

  if (client.connect(server, port))
  {
    Serial.println("connected");
    delay(1000);

  }
  else
  {
    Serial.println("connection failed");
  }
}

void loop()
{
  if (client.available())
  {
    char c = client.read();
    //Serial.println(c);
    distance = (uint8_t)c;
    Serial.println(distance);

    analogWrite(motor, distance);
  }

  if (!client.connected())
  {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    for(;;);
  }
    //delay(2000);
}

I tried doing factory reset a couple of times and the base firmware works fine. I can connect to tinker without any problems.

Hi @Sarang,

I think this changed recently and the documentation might not have been updated, sorry! We’re going to look into this and get back to you.

Thanks,
David

1 Like

Hi @Sarang,

I wasn’t up to speed on that feature, but that’s the intended behavior. In the SEMI_AUTOMATIC mode, the core won’t turn on the cc3000 unless you ask it to. http://docs.spark.io/firmware/#advanced-system-modes-semi-automatic-mode I think you want to call WiFi.connect() to connect to Wi-Fi but not automatically connect to the cloud.

Thanks,
David

1 Like

Do you know where the full new list of colours is located? I’ve had a good look around and i cant find it anymore!

Hi @Dave,

Thanks. Adding WiFi.Connect() to the code worked.

1 Like

Thank you!
FYI, it’s not clear from the docs that this is the case. The documentation states

The semi-automatic mode will not attempt to connect the Core to the Cloud automatically

It doesn’t say it won’t turn on WiFi or connect to WiFi either, however. The rest of the documentation separates connecting to WiFi and connecting to the cloud (WiFi.connect() and Spark.connect()).
Perhaps more clarification is could be added in the docs for what does and does not happen in these system modes.

1 Like

I’m curious about this as well, in Semi-Auto mode do I need WiFi.on(); as well as WiFi.connect(); and finally Spark.connect() or will Spark.connect() turn on the wifi and wait for a connection to the network (if needed) before connecting to the cloud? The documentation just says it’ll activate the Wi-Fi module but it’s unclear if it has to be on or connected first: “This will automatically activate the Wi-Fi module and attempt to connect to a Wi-Fi network if the device is not already connected to a network.”