Shop Learn
fdserial between two propeller 'flip' modules.; A Reopening - Page 4 — Parallax Forums

fdserial between two propeller 'flip' modules.; A Reopening



  • iseriesiseries Posts: 1,267

    One of the nice things about programming a value is you don't have to use different variable names to represent data.

    int Rspeed[] = {10, 20, 30, 80};  // <---speed or pulse per seconds.
    int Dspeed[] = {8, 20, 30, 80};   // <---speed or pulse per seconds.

    This represents the 4 mode speeds that you want to feed to the motors. Mode 0 is 10, 1 is 20, 2 is 30 and 3 is 80.
    Now if you find the motors are moving to fast or slow you can change these value to a smaller or larger number instead of changing the code that is working.
    I changed them to a smaller value so that you can see the LEDs blink which may not be right for the motors.


  • That doesn't answer my question , I still have an error at that point.

  • iseriesiseries Posts: 1,267

    What error, with what code. All the code in the example I provided compiled without errors and worked as shown in the video.

    To run the code all you needed to do was download the zip file and extract all the contents.


  • At first couldn't get code to upload into sinpleIDE so typed it and found errors, must something wrong with compiler , but I found codes in IDE folder and brought up codes in IDE aplication and uploaded codes into respective devices. happy to say it all works now but i need to change case 'X' to include a pulsed signal when all buttons are at 0 state.

  • iseriesiseries Posts: 1,267

    Makes no sense since a pulsed signal at all stop would me the motors continue to run uncontrolled.


  • Actually it does make sense since when one is not manually controlling such as slewing or on auto guiding the scope still has to continue moving at the sidereal speed which still has to be determined( approximate 10 - 13 Hz).

  • iseriesiseries Posts: 1,267

    I thought that's what a Guide Camera was for.

    The software is not capable of doing sidereal.


  • I think it is possible if I remove the void checkButtons routine replace ckeckGuider routine which is an older routine which has the defaultstatement (RmotorPin, 0, 10)
    (DmotorPin, 1, 0 )
    low (DDirPin)

  • bbrienbbrien Posts: 515
    edited 2022-04-07 00:00

    Actually the method didn't work so reinstalled the program you gave me but I changed the case 'X' to set output on the R channel to a pulse of 8 and high on dir pin , only problem is with the start. I want the 'X' line to run on start up. How do I do that? I always have to press a button to start.

  • iseriesiseries Posts: 1,267

    The X code should set the direction of movement before you start moving the motor.

          case 'X':
            square_wave(RmotorPin, 0, 6);

    After the fdserial_open code add the following 3 lines.

      Buffer[0] = '0';
      Buffer[1] = 'X';
      i = 3;

    After the while(1) remove the "i = 0;" statement. It is not needed.

    The code should look like this:

      fd = fdserial_open(FDrx, FDtx, 0, 115200);
      Buffer[0] = '0';
      Buffer[1] = 'X';
      i = 3;


  • GenetixGenetix Posts: 1,669


    You can assign a value to a variable when it's declared.

    char data = 'X';     // Start with CASE X.

    C allows an optional DEFAULT case but I am not sure if Propeller C supports it.

  • iseriesiseries Posts: 1,267

    @Genetix ,

    While that is true, in this case the preceding logic overwrites that value.


Sign In or Register to comment.