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

Convert x-sim > simtools Tacho Controller Arduino e36 Tone

Discussion in 'DIY peripherals' started by dahfl, May 4, 2014.

  1. dahfl

    dahfl New Member

    Joined:
    Feb 21, 2014
    Messages:
    29
    Occupation:
    Administrator
    Location:
    Mülheim Ruhr
    Balance:
    485Coins
    Ratings:
    +37 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, 6DOF
    Hi,
    now i controll my e36 cluster with x-sim and aruino uno.
    (sample from here )

    this work fine but i will use GameDash.
    how can i convert ?

    Arduino code:
    -------------------------------------------------------------------------------------
    #include <Tone.h>

    Tone kmh;
    Tone rpm;

    void setup() {
    kmh.begin(2);
    rpm.begin(3);
    Serial.begin(38400);
    }

    void loop() {
    if(Serial.available() > 0) {
    char kind_of_data = Serial.read();
    delay(1);
    int Data100 = Serial.read() - '0';
    delay(1);
    int Data10 = Serial.read()- '0';
    delay(1);
    int Data1 = Serial.read()- '0';

    //Daten anpassen: aus 1 wird 001, aus 10 wird 010 etc.
    while (Data1 < 0) {
    Data1 = Data10;
    Data10 = Data100;
    Data100 = 0;
    }
    int Data = 100*Data100 + 10*Data10 + Data1;

    //Speed ausgeben
    if (kind_of_data == 'S') {
    int Speed = map(Data,130,250,10,318);

    if(Speed > 316) {
    Speed = 316;
    }
    if(Speed < 33) {
    Speed = 0;
    }
    kmh.play(Speed);
    }

    //Drehzahl ausgeben
    else if (kind_of_data == 'R') {

    int Drehzahl = map(Data,0,630,0,270);
    if(Drehzahl > 270) {
    Drehzahl = 274;
    }
    if(Drehzahl < 25) {
    Drehzahl = 25;
    }
    rpm.play(Drehzahl);
    }
    }
    }
    --------------------------------------------------------------------------------

    x-sim config:
    Slide_1.jpg
    Slide_2.jpg
    Slide_3.jpg
    Slide_4.jpg
    Slide_5.jpg
    Slide_6.jpg
    Slide_7.jpg

    regards Andreas
    • Like Like x 1