Go Down

Topic: Don't mix two problems and think they are one (Read 958 times) previous topic - next topic


If your subject follows this pattern: "I have a problem getting my stepper motor react to my light sensor", you will give an impression that you either don't know anything about coding or you haven't even tried to make at least one thing work or you simply hope for some ready code.

This kind of subject contains two problems, which deserve their own questions and own threads. First you have to learn stepper motors. Then you have to learn sensors. If you know well both and still don't make it, the problem is in your coding skills, which you have to improve before dealing with hardware like this.

People who can help you, see these two problems in your question, while you give the impression that you see only one. That makes it hard to keep up an interesting thread.
- One day my stepper motor driver works like a charm. No task is too big for it and I can do anything with it. Next day it refuses to work and even the tiniest motor blows its fuse. What's wrong with it?
- It's bipolar.


Well said.
A lot of people say this in different ways, but it never hurts to hear it again!
When posting - use the toolbar and read the stickies if you're not sure!  </code> tags are our friend!
You can lead a plug to an outlet, but you can't make them turn it on.


Always remember it's the simple Input => Process => Output model.

Read stuff in, ponder, output other stuff.

Keep Calm and call 0118 999 88199 9119725...... 3


It's actually three problems:

  • Read the state of the light sensor.
  • Calculate what stepper motor output you want.
  • Command the stepper motor to perform the action you want.
Hackaday: https://hackaday.io/MarkRD
Advanced C++ Techniques: https://forum.arduino.cc/index.php?topic=493075.0


Mar 02, 2018, 04:04 pm Last Edit: Mar 02, 2018, 04:05 pm by Robin2
Very many Threads that I look at assume (for example) that if there is a line of code that detects a button press it must be immediately followed by the lines of code that cause something to happen.

  • the code {A} that collects information (for example button presses or instructions over a serial link)
  • from the code {B} that interprets the information
  • and from the code {C} that implements actions

makes program development much easier.

For example,  by seeing the job as 3 separate parts each can be thought about without the confusion of the other parts. And each part can be tested on its own.

Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up