# Struggling to figure out an error

**URL:** <https://community.particle.io/t/struggling-to-figure-out-an-error/36568>\
**Category:** Troubleshooting\
**Created:** [October 6, 2017, 11:44pm UTC](https://community.particle.io/t/struggling-to-figure-out-an-error/36568 "2017-10-06T23:44:19Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jryan15](https://avatars.discourse-cdn.com/v4/letter/j/9d8465/32.png) [@jryan15](https://community.particle.io/u/jryan15)\
**Post date:** [October 6, 2017, 11:44pm UTC](https://community.particle.io/t/struggling-to-figure-out-an-error/36568/1 "2017-10-06T23:44:20Z")

</div>

I’m very new at this and trying to build a function on a particle photon. I can’t seem to figure out how to resolve this error. Research has me thinking that it has to do with needing to pass a string to the function, but even when I add a string the “signal” variable still throws the error.

These are the errors:

`../wiring/inc/spark_wiring_cloud.h:193:39: invalid conversion from 'int (*)(signal*)' to 'int (*)(String)' [-fpermissive]
../wiring/inc/spark_wiring_cloud.h:196:17: initializing argument 2 of 'static bool CloudClass::_function(const char*, int (*)(String))' [-fpermissive]`

This is the code:

```auto

const int TX_PIN = 3; // Particle photon pin 3

typedef struct {
    boolean power;
    int duration; // micro seconds
} signal;

const signal SHORT_ON { true, 400 };
const signal SHORT_OFF { false, 500 };
const signal LONG_ON { true, 850 };
const signal LONG_OFF { false, 950 };
const int REST = 10000;

const char* host = "fancontrol";

signal sig_preamble [] { // 50 items total
    SHORT_ON, LONG_OFF, SHORT_ON, LONG_OFF, SHORT_ON, LONG_OFF, SHORT_ON, LONG_OFF,
    SHORT_ON, LONG_OFF, SHORT_ON, LONG_OFF, SHORT_ON, LONG_OFF, SHORT_ON, LONG_OFF,
    SHORT_ON, LONG_OFF, SHORT_ON, LONG_OFF, SHORT_ON, LONG_OFF, SHORT_ON, LONG_OFF,
    SHORT_ON, LONG_OFF, SHORT_ON, LONG_OFF, SHORT_ON, LONG_OFF, SHORT_ON, LONG_OFF
};

signal sig_power [] {
    SHORT_ON, SHORT_OFF,
    LONG_ON, SHORT_OFF,
    LONG_ON, SHORT_OFF,
    LONG_ON, SHORT_OFF,
    LONG_ON, LONG_OFF,
    SHORT_ON, LONG_OFF,
    SHORT_ON, SHORT_OFF,
    LONG_ON, LONG_OFF
};

signal sig_1 [] {
    SHORT_ON, LONG_OFF,
    SHORT_ON, SHORT_OFF,
    LONG_ON, SHORT_OFF,
    LONG_ON, SHORT_OFF,
    LONG_ON, LONG_OFF,
    SHORT_ON, LONG_OFF,
    SHORT_ON, SHORT_OFF,
    LONG_ON, LONG_OFF
};

signal sig_2 [] {
    SHORT_ON, SHORT_OFF,
    LONG_ON, LONG_OFF,
    SHORT_ON, SHORT_OFF,
    LONG_ON, SHORT_OFF,
    LONG_ON, LONG_OFF,
    SHORT_ON, LONG_OFF,
    SHORT_ON, SHORT_OFF,
    LONG_ON, LONG_OFF
};

signal sig_3 [] {
    SHORT_ON, LONG_OFF,
    SHORT_ON, LONG_OFF,
    SHORT_ON, SHORT_OFF,
    LONG_ON, SHORT_OFF,
    LONG_ON, LONG_OFF,
    SHORT_ON, LONG_OFF,
    SHORT_ON, SHORT_OFF,
    LONG_ON, LONG_OFF
};

int doIT(signal array[16]) {
    Serial.println("Doing transmission...");
    for (int burst = 1; burst <= 6; burst++) {
        for (int pre = 0; pre < 32; ++pre) { // Preamble
            digitalWrite(TX_PIN, sig_preamble[pre].power);
            delayMicroseconds (sig_preamble[pre].duration);
        }
        for (int idx = 0; idx < 16; ++idx ) { // payload
            digitalWrite(TX_PIN, array[idx].power);
            delayMicroseconds( array[idx].duration );
        }
        digitalWrite(TX_PIN, SHORT_ON.power); // postamble - is that a word?
        delayMicroseconds(SHORT_ON.duration);
        digitalWrite(TX_PIN, SHORT_OFF.power);
        delayMicroseconds(REST); // rest between bursts
     return 1;
    }
}

void loop() {

}

void setup() {
    Particle.function("doTrans", doIT);
}
```

---

<div class="post-metadata">

**Author:** ![BulldogLowell](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bulldoglowell/32/4305_2.png) [@BulldogLowell](https://community.particle.io/u/BulldogLowell)\
**Post date:** [October 6, 2017, 11:55pm UTC](https://community.particle.io/t/struggling-to-figure-out-an-error/36568/2 "2017-10-06T23:55:46Z")

</div>

[here](https://docs.particle.io/reference/firmware/photon/#particle-function-) in the docs...

> // SYNTAX  
> bool success = Particle.function("funcKey", funcName);

> // Cloud functions must return int and take one String \<\<\<\<\<\<\<\<\<\<\<\<\<\<\<\<\<\<\<  
> int funcName(String extra) {  
> return 0;  
> }

your function expects something else....

```cpp
int doIT(signal array[16]) {...

...
Particle.function("doTrans", doIT);

```

---

<div class="post-metadata">

**Author:** ![jryan15](https://avatars.discourse-cdn.com/v4/letter/j/9d8465/32.png) [@jryan15](https://community.particle.io/u/jryan15)\
**Post date:** [October 7, 2017, 1:01am UTC](https://community.particle.io/t/struggling-to-figure-out-an-error/36568/3 "2017-10-07T01:01:28Z")

</div>

Thanks for that. I got it working by creating a new function with only the one string input and then using if statements to call the other routine. So I’m all ready to go, but now I can’t call it, lol.

I’m on windows and don’t know the best way to send commands. I can see the particle from a command prompt and it sees my function when i type particle call, but when i try and run the function using:

particle call (device id) doTrans(3)

I get an error “function call failed permission denied”. I also tried the curl string, but it doesn’t even recognize “curl”.

Is the command prompt the best way to send commands for testing? How do I use the curl command?

I seen on a youtube video someone was able to open a terminal from the web interface, but I can’t tell what hot key he pressed to type “terminal” before it launched.

---

<div class="post-metadata">

**Author:** ![jryan15](https://avatars.discourse-cdn.com/v4/letter/j/9d8465/32.png) [@jryan15](https://community.particle.io/u/jryan15)\
**Post date:** [October 7, 2017, 1:41am UTC](https://community.particle.io/t/struggling-to-figure-out-an-error/36568/4 "2017-10-07T01:41:08Z")

</div>

finally got it working using this string from cmd prompt

particle call device\_id doTrans 3

---

<div class="post-metadata">

**Author:** ![Ric](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/ric/32/514_2.png) [@Ric](https://community.particle.io/u/Ric)\
**Post date:** [October 7, 2017, 3:12am UTC](https://community.particle.io/t/struggling-to-figure-out-an-error/36568/5 "2017-10-07T03:12:55Z")

</div>

> [@jryan15](#):
>
> particle call device\_id doTrans 3

You can also use the device's name instead of the id, which is a lot shorter 😉

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [October 7, 2017, 7:53am UTC](https://community.particle.io/t/struggling-to-figure-out-an-error/36568/6 "2017-10-07T07:53:34Z")

</div>

> [@jryan15](#):
>
> Is the command prompt the best way to send commands for testing?

The Particle console has a nice UI for that, and so do the mobile apps 🙂

---

<div class="post-metadata">

**Author:** ![jryan15](https://avatars.discourse-cdn.com/v4/letter/j/9d8465/32.png) [@jryan15](https://community.particle.io/u/jryan15)\
**Post date:** [October 7, 2017, 5:52pm UTC](https://community.particle.io/t/struggling-to-figure-out-an-error/36568/7 "2017-10-07T17:52:40Z")

</div>

How do I launch it from a windows laptop, lol. Did end up getting it to work from the command line. Thanks all for the help!

---

<div class="post-metadata">

**Author:** ![BulldogLowell](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bulldoglowell/32/4305_2.png) [@BulldogLowell](https://community.particle.io/u/BulldogLowell)\
**Post date:** [October 7, 2017, 6:32pm UTC](https://community.particle.io/t/struggling-to-figure-out-an-error/36568/8 "2017-10-07T18:32:12Z")

</div>

top of this post… hot link to CONSOLE

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [October 7, 2017, 8:51pm UTC](https://community.particle.io/t/struggling-to-figure-out-an-error/36568/9 "2017-10-07T20:51:25Z")

</div>

In case that doesn’t work…

 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/d/d5d86270731440abd1bd5f0935332959ace53f54.jpeg)

---

<div class="post-metadata">

**Author:** ![jryan15](https://avatars.discourse-cdn.com/v4/letter/j/9d8465/32.png) [@jryan15](https://community.particle.io/u/jryan15)\
**Post date:** [October 8, 2017, 1:28am UTC](https://community.particle.io/t/struggling-to-figure-out-an-error/36568/10 "2017-10-08T01:28:24Z")

</div>

Thanks for pointing me back. I’d been on that terminal 20 times before and couldn’t do anything from it. Just now found that there is a “device” section that let me run the curl function from.
