1. Do not share user accounts! Any account that is shared by another person will be blocked and closed. This means: we will close not only the account that is shared, but also the main account of the user who uses another person's account. We have the ability to detect account sharing, so please do not try to cheat the system. This action will take place on 04/18/2023. Read all forum rules.
    Dismiss Notice
  2. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  3. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  4. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

Arduino code for servo G-Seats

***** To prevent negative values and movement take @yobuddy's advice and use SimTools v2.4, then allocate a '0' for the min value in Sway and Roll.

***** Arduino code for G-Seats by @Spit40: https://www.xsimulator.net/community/threads/007-g-seat-ultra-compact-servo-based.10470/#post-139756

***** RC servo Code for Arduino UNO - 2DOF - Expandable 2.0: by eaorobbie
http://www.xsimulator.net/community/marketplace/rc-model-code-for-arduino-uno-2dof-expandable.89/
https://www.xsimulator.net/community/threads/rc-model-for-motion-simulation.4600/
interface setup - IMPORTANT - Assuming a 2DOF for SimTools 2 the Interface Output should be set like this R<Axis1a>~L<Axis2a>~

and for expanding code to use more servo http://www.xsimulator.net/community/threads/my-project-guide-me.5682/#post-59262
To add servos to my code , for example to include 4DOF with my code

Line 9 - How many Servos to use.
const int kActuatorCount = 4;

Line 13 - The Identifier used for Servo
const char kActuatorName[kActuatorCount] = { 'R', 'L' , 'F', 'B' };

Line 14 - Where is Servo is connected
const int kPins[kActuatorCount] = {3, 5, 6, 9};

Line 15 - 17 - Sets the scaleing in degrees of movement used , this is set for 180 deg if counting from 0
const int kActuatorScale[kActuatorCount][2] = { { 0, 179 } , // Right Actuator scaling
{ 179, 0 } , // Left side Actuator scaling
{ 179, 0 } , // Front side Actuator scaling
{ 179, 0 } }; // Back side Actuator scaling

Line 21 - Sets the Initial position of servo when in starts in Degree's
int actuatorPosition[kActuatorCount] = {90, 90, 90, 90};

Note in lines 15-17 if servo moves the wrong direction you can simply invert them by changing the scaling.

[​IMG]
Category:
gSeat
Published:
Oct 14, 2018
Page Views:
3130