Running linux client - basic commands not working


#1

Hi,

I’ve managed to connect my Intel Edison to Thinger using the linux client. When I try and run even basic tests by adding resources to the main.cpp though I am getting compilation errors, e.g. digitalPin or digitalWrite not declared.

What am I missing, do I need to include some more libraries? Are there more examples of how to create resources using the linux client? I’m just trying to read the state of a digital pin in the code below.

Cheers
M.

#include "thinger/thinger.h"

#define USER_ID             "xxx"
#define DEVICE_ID           "xxx"
#define DEVICE_CREDENTIAL   "xxx"

int main(int argc, char *argv[])
{
    thinger_device thing(USER_ID, DEVICE_ID, DEVICE_CREDENTIAL);

    // define thing resources here
    thing["Float"] >> digitalPin(3);

    thing.start();
    return 0;
}

root@HydroPo01:~/Linux-Client-master# ./run.sh
-- OpenSSL Version: 1.0.1m
-- Configuring done
-- Generating done
-- Build files have been written to: /home/root/Linux-Client-master/build
Scanning dependencies of target thinger
[ 50%] Building CXX object CMakeFiles/thinger.dir/src/main.cpp.o
/home/root/Linux-Client-master/src/main.cpp: In function 'int main(int, char**)':
/home/root/Linux-Client-master/src/main.cpp:36:35: error: 'digitalPin' was not declared in this scope
     thing["Float"] >> digitalPin(3);
                                   ^
CMakeFiles/thinger.dir/build.make:62: recipe for target 'CMakeFiles/thinger.dir/src/main.cpp.o' failed
make[3]: *** [CMakeFiles/thinger.dir/src/main.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/thinger.dir/all' failed
make[2]: *** [CMakeFiles/thinger.dir/all] Error 2
CMakeFiles/Makefile2:79: recipe for target 'CMakeFiles/thinger.dir/rule' failed
make[1]: *** [CMakeFiles/thinger.dir/rule] Error 2
Makefile:118: recipe for target 'thinger' failed
make: *** [thinger] Error 2
[4229521.095000]: Not connected!
[4229521.307000]: Connecting to iot.thinger.io:25202 ...
[4229522.467000]: Connected!
[4229522.467000]: Authenticating...
[4229522.614000]: Authenticated!

#2

Well I’m not expert but why you digitalPin() is not defined before the main? I think you are missing to include a header file or library where the digitalPin() is defined.


#3

Hi,

I agree, but I’ve no idea what those libraries are without the docs, which aren’t available on the linux client yet.

M.


#4

Thinger Linux Client is generic for Linux OS not for specific hardware or environment. You need to check Intel Edison’s documentations how to set a pin - check their c++ code examples, if any, and then merge the two in one code and compile.


#5

I’ve been following the Arduino examples and they state:
// add required headers according to your device

I’ve tried various versions of mraa and Gpio


#6

Hi, first of all, I would try to have some commands running from code, i.e., a simple C/C++ program changing some GPIOs in a main. With such program, we can start working in its integration with thinger.io. The arduino instructions does not apply to the headers definitions, just for the resource definition and methods.

If you cannot control GPIOs natively with a C/C++ program, we can just issue system calls, i.e, for running a python command through the system call.

So, do you have some command or C++ program, without thinger, to control your GPIOs?