3 Replies Latest reply on Aug 14, 2015 4:53 PM by CMata_Intel

    No output observed on Galileo gen2 when I run and upload actuation example from library

    Aman@iot

      Hello everyone here,

       

      I have somehow successfully transmitted sensor data from my galileo gen2 board to intel iot analytic and i am able to visualize the graph. Now i want some actuation work to take place but I am unable to do that.

      I registered component "powerswitch powerswitch.v1.0" in putty ssh and then observed it on catalog of putty itself, then i went to control panel of "Iot analytics Dashboard" webpage , selected components, then selected powerswitch, gave parameter and it transfer type I used both mtqq and websocketts one after the another. But none of them were able to run my led on

       

      The arduino code which I transferred was

       

       

      #include <IoTkit.h>    // include IoTkit.h to use the Intel IoT Kit

      #include <Ethernet.h>  // must be included to use IoTkit

      #include <aJSON.h>

      #include <stdio.h>

       

       

      // create an object of the IoTkit class

      IoTkit iotkit;       

      int temp;

      char buf[112];

       

       

      void setup() {

        Serial.begin(115200);

        // call begin on the IoTkit object before calling any other methods

        iotkit.begin();

        delay(10500);

        iotkit.send("power", 1);

      }

       

       

      void loop() {

        iotkit.receive(callback);

        delay(5000);

      }

       

       

      void callback(char* json) {

        Serial.println(json);

        aJsonObject* parsed = aJson.parse(json);

        if (&parsed == NULL) {

          // invalid or empty JSON

          Serial.println("recieved invalid JSON");

          return;

        }

        

        aJsonObject* component = aJson.getObjectItem(parsed, "powerswitch");

        aJsonObject* command = aJson.getObjectItem(parsed, "powerswitch.v1.0");

        aJsonObject* argv = aJson.getObjectItem(parsed, "argv");

        aJsonObject* argvArray = argv->child;

        aJsonObject* name = argvArray->child; // name : on

        aJsonObject* value = name->next; // value: 1/0

       

        if ((component != NULL)) {

          if (strcmp(component->valuestring, "power") == 0) {

            if ((command != NULL)) {

              if (strcmp(command->valuestring, "LED.v1.0") == 0 && strcmp(value->valuestring, "0") == 0) {

                Serial.println("Light Off!");

                pinMode(13, OUTPUT);

                digitalWrite(13, false);

              }

              if (strcmp(command->valuestring, "LED.v1.0") == 0 && strcmp(value->valuestring, "1") == 0) {

                Serial.println("Light on!");

                pinMode(13, OUTPUT);

                digitalWrite(13, true);

              }

            }

          }

        }

      }