Example 14‐RemoteControl of a motor with FlySky FS‐i6X - GSTCH/SketchMadeEASY GitHub Wiki

The Sketch Made EASY classes support the FlySky FS-i6X (10-channel) RemoteControl. Few more code is required to include these into a sketch.
If Sketch Made EASY is installed, it can be opened via menu: "File:/Example/SketchMadeEASY/Examples/14-MotorControlledByFlySky".

Schematic

Code

Adafruit MotorShield V2 at I2C‐Bus

#include <Easy.h>

//*****************************************************************
// Parameter  I2C Motor
#define MOTOR_NUMBER 1

void setup()
{
  //((*** Initialize: Configure your sketch here....
  //** Create actuator:
  Actuator* motor = new MotorI2C(MOTOR_NUMBER);

  //** Define Input
  // RemoteControl, connected with iBus.
  RemoteControl* flySky = new FlySky(scHard2);

  //** Define logic with condition and relation
  // No condition (NULL) because the relation is always active. 
  // With GetControl the FlySky class creates the input control and returns its pointer. 
  Relation* relationFlySkyToMotor = new Relation1to1(NULL, motor, flySky->getControl(rcJoystick1Y));
  // ***))

  // Initialize control
  ControlManagerFactory::GetControlManager()->Setup();
}

//*****************************************************************
void loop() {
  //*** Run: No additional code is required
  ControlManagerFactory::GetControlManager()->Loop();

  // Depending on Arduino it needs a short delay. Do not add any other delays!
  delay(5);
}

L9110

Code only, look at previous examples 6-10 for schematic

#include <Easy.h>

//*****************************************************************
// Parameter Motor L9110
#define MOTOR_PINA1 11
#define MOTOR_PINB1 12
#define MOTOR_PINA2 44
#define MOTOR_PINB2 46

void setup()
{
  //((*** Initialize: Configure your sketch here....
  //** Create actuator:
  Actuator* motor = new MotorL9110(MOTOR_PINA1, MOTOR_PINB1);

  //** Define Input
  // RemoteControl, connected with iBus.
  RemoteControl* flySky = new FlySky(scHard2);

  //** Define logic with condition and relation
  // No condition (NULL) because the relation is always active. 
  // With GetControl the FlySky class creates the input control and returns its pointer. 
  Relation* relationFlySkyToMotor = new Relation1to1(NULL, motor, flySky->getControl(rcJoystick1Y));
  // ***))

  // Initialize control
  ControlManagerFactory::GetControlManager()->Setup();
}

//*****************************************************************
void loop() {
  //*** Run: No additional code is required
  ControlManagerFactory::GetControlManager()->Loop();

  // Depending on Arduino it needs a short delay. Do not add any other delays!
  delay(5);
}

L298

Code only, look at previous examples 6-10 for Schematic

#include <Easy.h>

//*****************************************************************
// Parameter Motor L298
#define MOTOR_SPEEDPIN 11
#define MOTOR_DIRECTIONPIN 12

void setup()
{
  //((*** Initialize: Configure your sketch here....
  //** Create actuator:
  Actuator* motor = new MotorL298(MOTOR_DIRECTIONPIN, MOTOR_SPEEDPIN);

  //** Define Input
  // RemoteControl, connected with iBus.
  RemoteControl* flySky = new FlySky(scHard2);

  //** Define logic with condition and relation
  // No condition (NULL) because the relation is always active. 
  // With GetControl the FlySky class creates the input control and returns its pointer. 
  Relation* relationFlySkyToMotor = new Relation1to1(NULL, motor, flySky->getControl(rcJoystick1Y));
  // ***))

  // Initialize control
  ControlManagerFactory::GetControlManager()->Setup();
}

//*****************************************************************
void loop() {
  //*** Run: No additional code is required
  ControlManagerFactory::GetControlManager()->Loop();

  // Depending on Arduino it needs a short delay. Do not add any other delays!
  delay(5);
}
⚠️ **GitHub.com Fallback** ⚠️