Announcement

Collapse
No announcement yet.

rotating primitive with IO1 pin ?

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

  • rotating primitive with IO1 pin ?

    Hello again Paul and everybody.

    I would like to use the uOLED-96-G2 to see the position of my joystick ( the position of the potentiometer inside the joystick).

    I understand how to connect my potentiometer to the IO1 pin of the uOLED and already did that.

    So my joystick(the potentiometer inside ) rotates 45 degrees back and forth.
    When its centered the voltage to IO1 is 1,64v.
    And at the ends 1.4v on one side and 1,9v on the other.

    Maybe its possible to rotate a primitive triangle with its corner centered on the screen to simulate the position of my joystick?
    Is it possible to rotate a primitive?

    The other thought i had is to make 45 images for the 90degrees of travel (2degree change for each 0.01v of change between 1.4v to 1.9v)
    And if there was a code to display each image during voltage change..

    Im only a hobbyst and have no experience in program language 😩 ..so any help and thoughts are welcome

    Thank you in advance for any replies




  • #2
    Hi,

    It isn't possible to rotate a primitive but it is possible to draw a traingle with the 3 points in different loctations however the previously drawn triangle would have to be erased before a new traingle at a different position is drawn.

    It may be best to make images for this to represent the change in your potentiometer.

    Best regards

    Paul

    Comment


    • #3
      Hello there Paul,
      thank you for your reply!

      Could you please paste me the code that can read potentiometer voltage and can change images back and forth? Forgive my ignorance, im a beginner in making code

      When my potentiometer is centered the voltage to IO1 is 1,64v. This will show the "center" image.
      My potentiometer at the ends is 1.4v on one side and 1,9v on the other. I need the transition from the 1.64v to the one side of the 1.4v to show a different image during this voltage change.Also for the other end..

      I hope to control the change of many images so the effect will look smooth...

      Thank you!
      Best Regards
      George
      Last edited by george1; 4 May 2020, 04:18 PM.

      Comment


      • #4
        Also had a look on the Goldelox Joystick project,
        but i dont hink this is for me as i need to control more than 5 images and not with switches but with a potentiometer.
        Any idea what is the code i need and how i can assign them to voltage changes in this code?🤔

        Thank you!

        Comment


        • #5
          Hi,

          For your task you would need to use pin_Read and pin_Set. Pin_Read will give you a different value based on the position of the potientiometer.

          page 12 https://4dsystems.com.au/mwdownloads...ad/link/id/18/

          I will re-create your setup and make an example.

          best regards

          Paul

          Comment


          • #6
            Hello there Paul !

            I very exiting you found a code for my project!
            Waiting,thank you!

            Best Regards
            George

            Comment


            • #7
              Hello Dear Paul !
              Did you had any luck with the code ?

              Thank you!
              Best Regards
              George

              Comment


              • #8
                Hello everybody,

                maybe anyone have any ideas how this code should be

                Thank you in advance for any replies

                Comment


                • #9
                  anyone?

                  Comment


                  • #10
                    Hi,

                    Good Day.

                    Apologies for the delay.
                    .
                    You can print the reading from the potentiometer into the screen first to see if what will be the value at the center.
                    Then, get the difference between the center value and the value read by potentiometer when you turn the knob to left or right.
                    If the value is less than the center value then you can decrement the image frame.
                    And if the value is greater than the center value then you can increment the image frame.

                    I hope this helps.

                    Best Regards,
                    Ferdinand

                    Comment


                    • #11
                      Hello there Ferdinand,

                      i know the voltages but i dont know how the code should be
                      Can you attach me the sample code please?

                      Thank you
                      Last edited by george1; 14 May 2020, 06:11 AM.

                      Comment


                      • #12
                        Hi George,

                        Good Day.

                        Please see attached sample code on how you can get a reading from the potentiometer that is attached to IO1. You can calculate the difference between the new value and the old value which you can use to increment or decrement a frame.

                        I hope this helps.

                        Best Regards,
                        Ferdinand
                        Attached Files

                        Comment


                        • #13
                          Hello Dear Ferdinand ,
                          thank you for your guidance because i am new to programming

                          The result readings are:

                          -when the pot is center "NEW:131 OLD:131 Diff is 0"
                          -when the pot is to one end "NEW:155 OLD:155 Diff is 0"
                          -when the pot is to the other end "NEW:107 OLD:107 Diff is 0"

                          What the code should be to assign my images to this numbers so i can represent the move in my potentiometer on the screen please?
                          And how i do that in Visi environment ? I add extra "Forms" or more "Images" in a "Form"?

                          Thank you very much for your time and help.
                          Kind Regards
                          George
                          Last edited by george1; 18 May 2020, 11:44 PM.

                          Comment


                          • #14
                            Dear George,

                            Good Day.

                            Please check the attached project as a reference. You can use Userimages to add multiple images.

                            I hope this helps.

                            Best Regards,
                            Attached Files

                            Comment


                            • #15
                              Hello again Ferdinand,
                              thank you for all your help and time.

                              I have successfully upload the project to the uOLED-96-G2 , but it looks that the change of all images take place between 129 and 131 of pots input (in one or two degrees of pots rotation).
                              Very sensitive.

                              How i can "expand" please this reading resolution between 107 to 155 so i can change the same or more images in wider range and maybe more smoothly?

                              Thank you in advance for your reply!
                              Kind Regards
                              George
                              Last edited by george1; 19 May 2020, 02:42 AM.

                              Comment

                              Working...
                              X