Realtime Mapping of values of GUI of Knob and Physical knob

Hi, I want to map real-time value of how much the knob is turned on the GUI . This should in turn reflect on the physical knob too, when I use from GUI. Currently now I have created a sample code from GUI to knob, but I am unable to map it back.

post your code then we can elaborate on that

Right now, I am using stepper motor and the interface is controlling the motor.

StepArd.ino (702 Bytes)

ControlP5knobJustGUI.pde (1.29 KB)

Right now, I am using stepper motor

This “stepper” motor?

#include <Servo.h>

Servo myServo1;

The GUI is sending a position to the Arduino, which moves the stepper. So, what is it that the GUI needs to know from the Arduino?

Currently now I have created a sample code from GUI to knob

Is that a doorknob you are referring to?

Maybe English is not your native language, but we have no idea what you are talking about.

Sorry for the confusion.
I am controlling a fan. I have a servomotor which is controlling the fan speed. I have a GUI on processing which does the same. So whenever I change the values from GUI, the knob (servo) turns and value. And whenever I turn the knob, the GUI will also shows the value which its turned.

Hopefully understood, please help me out.

pradeep3043:
Sorry for the confusion.
I am controlling a fan. I have a servomotor which is controlling the fan speed. I have a GUI on processing which does the same. So whenever I change the values from GUI, the knob (servo) turns and value. And whenever I turn the knob, the GUI will also shows the value which its turned.

Hopefully understood, please help me out.

Sorry, but you still have a lot of explaining to do.

Start with the physical equipment you have. List all the items and describe exactly how they are connected to each other.

Then explain, step by step, what is supposed to happen.
For example if you turn the knob (you will already have told us what the knob is connected to) by hand what happens?

It seems that turning the knob by hand also causes data to be sent to your PC (what data, how often) to make a picture of a knob rotate in sync with the physical knob?

If you use your PC software to rotate the picture of the knob it seems like you want the physical knob to rotate? What machinery have you to make that happen?

Remember, you know all about your project and we know nothing until you tell us.

...R

I am trying to achieve this. Once the servo is actuated , i am unable to turn the servo . I need a two way control to fan from both physical knob and a GUI knob.

And whenever I turn the knob, the GUI will also shows the value which its turned.

This implies that you expect to get position data from the servo when you manually override the position you commanded it to go to. Aside from the risk of damaging the servo that you are taking, you can NOT get position information from the servo. At best, it will tell you where you told it to go, not where it is.

You need a much different mechanism for controlling the fan speed, that involves some kind of encoder to get position data.

pradeep3043:
I am trying to achieve this. Once the servo is actuated , i am unable to turn the servo .

I have the same problem as @PaulS

I had assumed your physical knob was on the shaft of a potentiometer and my question "it seems like you want the physical knob to rotate? What machinery have you to make that happen?" was based on that.

What you are trying to do is eminently possible but is by no means simple.

You need a reversible machine to turn the knob - reversible in the sense that it does not damage the machine if you turn the knob by hand. At the same time you need some sort of encoder that can tell the Arduino how far the knob has been turned. And, of course, you need some way to connect the motor to the potentiometer.

One of these encoder motors (or something similar) might be suitable - but the coding will be complex.

Remember, also, that Processing will know what "position" to send to the Arduino and the Arduino can use that data to control the speed without ever moving the potentiometer.

It would be a good idea to reconsider whether you really need this complicated system.

...R