setrelay()

Function Definition: setrelay(state = 1, pin = "D3")

Parameters

NameTypeDescriptionExpected ValuesDefault Value
stateintThe state of the relay. 1 for High, 0 for Low.0 or 11
pinstringThe pin of Quarky or the Expansion board where the relay is connected."D3", "A1", "A2", "S1", "S2", "T1", "T2", "T3", "T4", "T5", "EXP_1", "EXP_2", "EXP_3", "EXP_4", "EXP_5", "EXP_6", "EXP_7", "EXP_8""D3"

Description

The function set the state of the relay connected to the selected pin to High or Low. A high state means that the pin will have 3.3V and for Low, the pin will be 0 V.

There are lots of pins to which a relay can be connected:

  1. Digital Pin: D3
  2. Analog Pins: A1 and A2
  3. Servo Pins: S1 and S2
  4. Touch Pins: T1, T2, T3, T4, or T5
  5. Expansion Board Servo Pins: EXP_1, EXP_2, EXP_3, EXP_4, EXP_5, EXP_6, EXP_7, and EXP_8.

Example

There are no examples documented for this article.
Table of Contents