EN RU CN
Example of Triggering the Aux with HI using Serial Command
  • What would the syntax of serial command that triggered the AUX1 with STATE of HIGH look like?

    I am trying to trigger a camera shutter module that needs a HIGH.



    Here is the documentation but does not show the the syntax.

    CMD_TRIGGER_PIN - Trigger pin
    PIN_ID 1u Triggers pin only if it is not used for input
    RC_INPUT_ROLL = 1
    RC_INPUT_PITCH = 2
    EXT_FC_INPUT_ROLL = 3
    EXT_FC_INPUT_PITCH = 4
    RC_INPUT_YAW = 5 (BOARD_VER >= 30)
    PIN_AUX1* = 16
    PIN_AUX2* = 17
    PIN_AUX3* = 18
    PIN_BUZZER* = 32
    PIN_SSAT_POWER** = 33
    * On boards v1.x (based on Atmega328p) PIN_AUX1..3 are not
    present as outputs, and should be soldered to pin2, pin11,
    pin12 of MCU correspondingly. PIN_BUZZER is mapped to
    pin32 of MCU.

    STATE 1u LOW = 0
    HIGH = 1
    LOW - pin can sink up to 40mA
    HIGH - pin can source up to 40mA

  • I am going to try this:

    #define SBGC_PIN_AUX1 16

    // Some definitions required to

    #define SBGC_CMD_CONTROL 'C'
    #define SBGC_CMD_TRIGGER 'T'

    typedef struct {
    uint8_t pin;
    int8_t state;
    } SBGC_cmd_trigger_data;

    // This helper function formats and sends a command to SimpleBGC Serial API

    void SBGC_sendCommand(uint8_t cmd, void *data, uint8_t size) {
    uint8_t i, checksum=0;

    // Header
    Serial.write('>');
    Serial.write(cmd);
    Serial.write(size);
    Serial.write(cmd+size);


    // Body for(i=0;ichecksum+= ((uint8_t*)data)[i];
    Serial.write(((uint8_t*)data)[i]); }
    Serial.write(checksum); }
    /*****************************************************************************/




    t.pin = SBGC_PIN_AUX1;

    t.state = 1;
    SBGC_sendCommand(SBGC_CMD_TRIGGER, &t, sizeof(t));