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

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

124»

Comments

  • iseriesiseries Posts: 1,273

    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.

    Mike

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

  • iseriesiseries Posts: 1,273

    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.

    Mike

  • 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,273

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

    Mike

  • 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,273

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

    The software is not capable of doing sidereal.

    Mike

  • 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 )
    high(RDirPin)
    low (DDirPin)

  • bbrienbbrien Posts: 525
    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,273

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

          case 'X':
            low(DdirPin);
            high(RdirPin);
            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;
    
      while(1)
      {
        /**
    

    Mike

  • GenetixGenetix Posts: 1,683

    bbrien,

    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,273

    @Genetix ,

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

    Mike

  • Actually one can use a DSLR camera on almost any sized scope if one has the correct adapters. I have used on my 10 inch Newtonian, Six inch Newtonian, $ inch Cassagrain, and my 10 inch Schmidt-cassagrain scope. Still haven't got the DUAL Stepper program to work.

  • MicksterMickster Posts: 2,217

    The Cure for stuff that "doesn't work"?

    BASIC :lol::+1:

  • What "basic " are you referring to.

  • MicksterMickster Posts: 2,217

    @bbrien said:
    What "basic " are you referring to.

    FlexBasic...stuff just works :+1:

    I still love PropBASIC for the P1 also (search the forum). It has built-in serial comm's and again, they simply just do what they're told...child's play.

    I spend my time doing stuff not figuring out how to do it.

    Craig

Sign In or Register to comment.