Blinking LED in particle photon [beginner question]

Hi, im having troubles working with curl on terminal (mac). I have this following code flashed on to the photon device:

int led = D7;

void setup() {

pinMode(led, OUTPUT);
digitalWrite(led, LOW);

Particle.function("toggle", toggleLights);

int toggleLights(String command) {
if (command == "on") {
    digitalWrite(led, HIGH);
    return 1;
else return 0;

void loop() {


and when I run

 curl[device id]/toggle \
 -d access_token=[access token] \
 -d "args=on”

it gives me this:

"id": [device id],
"last_app": "",
"connected": true,
"return_value": 0

when I want the return value to be 1 and make the built-in LED blink.

What am I doing wrong here?

Thank you in advance.

Could you give this a shot instead?

curl \
  -d access_token=123412341234 \
  -d params=on

Thank you so much! It worked! But why does it say “args=” in the official documentation then?? Is there a specific situation to use it?

Could you show me a link to that? I’ve used this:
its at the very bottom of particle.function() page