hi, i want to use stepper motor via blynk with esp8266 l298n I want to add a swich with the driver, but how can I do it to stop it and run it again via blynk?
You should provide as much details as possible like, blynk legacy (the old one) or IOT (the new one), library version, full sketch, etc.
Have you tried searching this community forum for similar projects?
My guess is that you haven’t as there are many existing examples available already.
Pete.
Of course, I looked at all the topics, but I couldn’t find a manual blynk code project that provides stopping with a swich switch.
[Unformatted code removed by moderator]
how can i put switch in this code
First of all, you should read this
https://docs.blynk.io/en/legacy-platform/legacy-articles/keep-your-void-loop-clean
I want it to stop automatically when the stepper motor is running with the help of blynk and swich.
@Yusuf_Gdk Please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```
Copy and paste these if you can’t find the correct symbol on your keyboard.
Pete.
this is the code. I request you to add switch code to stepper motor
please explain what are you trying to achieve exactly.
Before we can give you any guidance about hoe to do that, we need to understand exactly what it is that you are hoping to achieve.
This project already has two switch widgets, what is it that your addition switch is meant to do?
Also, the code in this project is incredibly badly written, and if you’ve read the “keep your void loop clean” link that @John93 provided then you’ll realise this.
Members of this user community are happy to help other users, but it’s difficult to help if you don’t explain what it is that you are trying to achieve, or don’t take the time to read the links that we provide.
Also, it seems that you’d rather search YouTube for information than this forum, which isn’t the best approach in my opinion.
Pete.
In this way, when the switch is connected and the stepper motor comes to the end of the drawer, it should stop by the automatic switch. Could you help
Okay, a limit switch.
Connect one side of the switch to GND and the other to one of your GPIO pins.
In void setup add a pinMode statement that declares the pin as an INPUT_PULLUP.
You then have two choices:
-
attach an interrupt that pin, and when that interrupt is triggered it calls a function which will stop the stepper motor.
-
poll the pin using a timer, checking if the pin has changed from HIGH to LOW, indicating that the switch has changed state. If it has then call a function which will stop the stepper motor.
The details of what your function to stop the stepper motor will look like depends a lot on how you restructure the original sketch to sort-out the void loop.
Pete.
I do not have the knowledge to do this procedure, can you do it for me, please?
I’m not going to write your code for you, but you may be lucky and find another forum member who will.
I prefer to coach people to write their own code, and learn a new skill in the process.
Pete.
So, your project is a drawing machine. Personally, I don’t think Blynk is suitable for such a project.
I realized that blynk can’t make it
You can use blynk to control a stepper motor, but it’s not suitable for drawing machine or CNC projects.
I’d suggest using GRBL firmware instead.