The “Control LEDs over the 'Net” example at http://docs.spark.io/#/examples/control-leds-over-the-net seems to have an off-by-one bug. The comment prior to the
ledControl() function in the sketch indicates the command string should contain “l1,HIGH” or “l1,LOW” to manipulate LED #1 or “l2,HIGH” or “l2,LOW” to manipulate LED #2, implying that the LED # is to be passed in as part of the command. However, the code calculates pin number from the command string, not LED #, validates pin number (properly) on the interval (0,1), and uses it in the call to
digitalWrite(). That would mean that if you pass in “l1” as part of the command string you’ll actually turn on LED 2, not LED 1. (Note that this happens in the curl command included in this example…)
If you want the command string to actually specify LED # and not pin number then you need to change the code. There are a variety of ways to do this ranging from simple ones (e.g., subtracting ‘1’ instead of ‘0’ in calculating
ledControl() ) to more complex ones if you really want to decouple LED # in the command string from whatever pin number might be assigned to the LED.