I am trying to solve a problem with this code about the stepmotor. What I want it to do is that depending on the temperature it turns to one side or the other (simulating a blind). But this one does it in a loop and doesn't stop.
I leave it below in case someone can help me. ; )
Do you want the motor to step 20 a single time when the temperature is one way and then turn 20 the other way once when the temperature gets over the set point (24)? The way your code runs now, the 20 steps happens every single time the loop runs and that is many times per second.
You need a global variable to store the motor position and only change the motor position once per temperature flip. When the motor position and required position don’t match, then command the motor 20 steps.
Would love to give a more detailed answer, but don’t have time. Will check back later though.
Thank you very much for responding, in the meantime I will try to make the variable that you recommended.
If you could look at it today it would be great for me since I need this job for tomorrow and I'm a little lost. But thanks anyway
Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.
Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.
Repeated duplicate posting could result in a temporary or permanent ban from the forum.
Could you take a few moments to Learn How To Use The Forum. It will help you get the best out of the forum in the future.
Thank you.
➜ seems this was solved in the Spanish speaking section, you could have had the decency to to come here and close this thread....
I'm locking it. don't cross post ever again please.