Announcement

Collapse
No announcement yet.

rotating primitive with IO1 pin ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Trying but i havent fix the problem
    Any thoughts ?

    Comment


    • #17
      Paul , Ferdinand or any other 4D experts reading,

      could you help please ?

      Comment


      • #18
        Hi George,

        Good Day.

        You can get the difference from the maximum resolution to the minimum resolution and divide it by the number of images that you want to display. Then make a logic on which image to be shown with the range of resolution.

        I hope this helps.

        Best Regards,
        Ferdinand

        Comment


        • #19
          Hello Ferdinand ,
          thank you for replying.Its been two weeks and i had no success

          I am only a hobbyist and have no experience in code making .How the "logic" code you refer , should be so i can paste it ?

          This is my code at the moment:


          "

          func main()
          // Uncomment the following if uSD images, fonts or strings used.

          print("Starting\n") ;
          while(!media_Init())
          putstr("Drive not mounted...");
          pause(200);
          gfx_Cls();
          pause(200);
          wend

          var started := 0, old, new, diff, reading, frame := 0;
          pin_Set(ANALOGUE_8, IO1);


          repeat
          reading := pin_Read(IO1);
          if (!started)
          new := reading;
          started := 1;
          else
          old := new;
          new := reading;
          diff := new - old;
          //txt_MoveCursor(0, 0);
          //print("NEW: ", new," \n");
          //print("OLD: ", old, " \n");
          //print("Diff is ", diff, " \n");
          endif
          if (diff > 0 )
          if (new > 131)
          frame := frame + 10;
          if (frame > 7) frame := 7;
          txt_MoveCursor(5,0);
          //print(frame);


          else if (new < 131)
          frame := frame - 10;
          if (frame < 0) frame := 0;
          endif
          // Userimages1 1.0 generated 16/05/2020 2:49:00 pm
          media_SetAdd(iUserimages1H, iUserimages1L) ; // point to the Userimages1 image
          media_VideoFrame(0, 0, frame) ; // where frame is 0 to 7
          endif
          forever
          endfunc


          "


          I would like to be able to change 10 images between 114-148 IO1 pot reading with center the 131 .

          Maybe you can paste me a sample how this "logic" code should be so i can experiment please?

          Thank you and sorry for my multiple post ..i am trying two weeks now with no success because im not an expert .
          Looking forward for your reply!
          George
          Last edited by george1; 25 May 2020, 05:51 PM.

          Comment


          • #20
            Dear George,

            Please try the attached file as a reference.

            It only has 7 frames on the project but you can change the diff according to your no. of frames.
            Then add the additional frames on the else if statement.

            I hope this helps.

            Best Regards,
            Ferdinand

            Attached Files

            Comment


            • #21
              Thank you Ferdinand,

              going now to try! Will let you know!

              Best Regards
              George

              Comment


              • #22
                Hello again Ferdinand,
                i am only able to rotate between three images 3,4 and 5.

                Is there an email i could contact you direct for faster communication please because in a few days i go back to work and wont have any more free time

                Thank you

                Comment


                • #23
                  Dear George,

                  How did you use the code into your project?

                  You can contact me at ferdinand at 4dsystems dot com dot au.

                  Best Regards,
                  Ferdinand

                  Comment


                  • #24
                    Thank you!
                    You have email

                    Comment

                    Working...
                    X