As many of you know, the Spark people generously gave us two Spark Core devices to connect to our graphing calculators. It's been fun getting to know the device, but as it's still in its early days, there are plenty of confusing bits and incomplete documentation to work around. This topic is for documenting everything unexpected that we (or you!)

Setting WiFi Credentials and Connecting in Code
If you want your code to be able to set WiFi credentials in code, then connect to the network, there are a few gotchas that you need to be aware of:
  1. If you are using SEMI_AUTOMATIC mode, you must call WiFi.on() before you do things like setCredentials(), clearCredentials(), and so on.
  2. If you get a "hard fault" error code from the RGB LED (that is, SOS in Morse code, one single flash, then SOS in Morse code again), you probably didn't call WiFi.on() before doing something like clearCredentials(). This is barely documented in existing documentation.
  3. If setCredentials() appears to take fewer that ~8 seconds, it didn't work. Debugging LEDs and Serial.print statements help a lot with this.

For your edification, the following code will set credentials and then connect to WiFi.

// Spark Core WiFi Credentials + Connect Demo
// By Christopher Mitchell, 2014
// No rights reserved for this code; WTFPL applies


void setup() {
    // Press any key over a serial connection to start connecting
    while (!Serial.available()) { };
    Serial.println("Setting credentials.");
    WiFi.setCredentials("MySSID", "MyWiFiPassword", WPA2);
    Serial.println("Credentials set.");

void loop() {

    if (!WiFi.ready()) {
        if (WiFi.connecting())
            return;                     // Wait for it to connect
        if (!WiFi.hasCredentials())     // Wait for credentials
        Serial.println("Calling connect.");
        return;                         // We'll get back here eventually
    if (WiFi.ready()) {
        Serial.println("WiFi is ready.");

This looks amazing! I can't wait to try it. I have some questions, though:
1. Does the Spark Core Require a battery?
2. What pins do I connect the half I/O cable and battery to?
3. How do I install the firmware to the Core?

Sorry if these were answered, I didn't look around much and I'm kind of a newb. Smile
The spark core it self can be powered via the computer an external battery. Or in this case you can wire it up to the battery pack of the calculator if you are so inclined.

You would connect them as such
TIring = D5;
TItip = D6;
battery would go to VIN and ground

for the firmware you would copy this file as a project on the spark web IDE
make sure that spark core is defined and then compile and flash it Very Happy
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum