UNPKG

cylon-spark

Version:

Cylon adaptor for the Particle Core & Photon device

111 lines (60 loc) 1.76 kB
# Commands ## digitalRead(pin, callback) Reads a value using digital write to a pin. ##### Params - **pin** - the value of the pin - **callback** - params for the pin value ##### Returns `callback integer` ## digitalWrite(pin, value) Writes a value using digital write to a pin. ##### Params - **pin** - the value of the pin - **value** - paramas for the pin value ##### Returns `null` ## analogRead(pin, callback) Reads a value using analog write to a pin. ##### Params - **pin** - pin data - **callback** - callback data ##### Returns `callback integer` ## analogWrite(pin, value) Writes a value using analog write to a pin. ##### Params - **pin** - the value of the pin - **value** - paramas for the pin value ##### Returns `null` ## pwmWrite() Writes the pwm value.(analogWrite) ##### Returns `null` ## servoWrite() Writes the servo value.(analogWrite) ##### Returns `null` ## command(commandName, args, callback) Calls a function on the Spark Core via the API. ##### Params - **commandName** - string name of the function to call on the Spark - **args** - array of arguments to pass to the function call - **callback** - optional, callback to be triggered with the response_value from Spark's API ##### Returns `null` ## variable(variableName, callback) Requests the value of a variable from the Spark Core via the API ##### Params - **variableName** - name of the variable to request from the Spark Core - **callback** - callback to be triggered with the value from the Spark Core ##### Returns `null` ## listenForEvents(events) Listens to Server-Sent Events coming from the Spark Core, and emits the same events. ##### Params - **events** - array of events to add listeners for ##### Returns `null`