Will pay for help creating code

Hi. I am in need of some help creating code to go along with the instructions here “Weather API | Tutorials | Particle”. I have followed the instructions and got it working with the webhook, and outputting the data to the particle console. But I have no idea how i got it to that point in the code running on the photon. I have autism and my mind can’t make the connections that this level of programming requires so need someone who is not disabled to create code that outputs what is being sent to the particle web console. to instead store it in a variable i can use with some basic code i want to create on the photon. Here is the code i have running on the photon:

#include "Particle.h"

SerialLogHandler logHandler;

void subscriptionHandler(const char *event, const char *data);

SYSTEM_THREAD(ENABLED);

const char *EVENT_NAME = "GetWeatherData";

enum {
    STATE_WAIT_FOR_CONNECTED,
    STATE_WAIT_TO_PUBLISH,
    STATE_IDLE
};
int state = STATE_WAIT_FOR_CONNECTED;
unsigned long stateTime;

void setup() {
    // {{{PARTICLE_DEVICE_ID}}}/{{{PARTICLE_EVENT_NAME}}}
    Serial.begin(9600);
    String subscriptionName = String::format("%s/%s/", System.deviceID().c_str(), EVENT_NAME);
    Particle.subscribe(subscriptionName, subscriptionHandler, MY_DEVICES);
    Log.info("subscribing to %s", subscriptionName.c_str());

}

void loop() {
    switch(state) {
        case STATE_WAIT_FOR_CONNECTED:
            if (Particle.connected()) {
                state = STATE_WAIT_TO_PUBLISH;
                stateTime = millis();
            }
            break;

        case STATE_WAIT_TO_PUBLISH:
            if (millis() - stateTime >= 5000) {
                Particle.publish(EVENT_NAME, "", PRIVATE);
                state = STATE_IDLE;
            }
            break;

        case STATE_IDLE:
            break;
    }
}


void subscriptionHandler(const char *event, const char *data) {
    JSONValue outerObj = JSONValue::parseCopy(data);

    JSONObjectIterator iter(outerObj);
    while(iter.next()) {
        if (iter.value().isArray()) {
            JSONArrayIterator iter2(iter.value());
            int index = 0;
            while(iter2.next()) {
                JSONObjectIterator iter3(iter2.value());
                while(iter3.next()) {
                    Log.info("%s index=%d key=%s value=%s", 
                        (const char *) iter.name(),
                        index,
                        (const char *) iter3.name(), 
                        (const char *) iter3.value().toString());
                }
                index++;
            }
        }
        else {
            Log.info("key=%s value=%s", 
                (const char *) iter.name(), 
                (const char *) iter.value().toString());
        }
    }
}

I would like it to pull the weather id code maybe once every 10 minutes. with the id code being stored in a variable named “MyWeatherIDCode” this variable will be later used to make a led display change. I only need the current weather id code.

I’d be happy to help you understand the code you got there and guide you on the way to your solution - no payment required.

7 Likes