Hello Arduino, I’ve never coded in my life, I have a very simple project and I was planning on learning the code I need to complete it but I’ve never had so much difficulty finding the appropriate material in anything I’ve planned on learning before. It’s been weeks and I’ve gone round and round in circles. I want to control a dc motor a stepper motor a solenoid and some micro switches all on one system. I’ve never been so disappointed with learning material to be honest yet Arduino says it’s great and full of resources. Today I started trying to find someone to do it for me which feels so wrong when I love learning new things and find learning very easy but at the moment it feels like I’ve been told to learn a foreign language with no dictionary. Can anyone help? Only one guy on you tube I found good, amazing in fact but he only taught a very simple system. I’m begging someone to advise.
Nick1664:
I want to control a dc motor a stepper motor a solenoid and some micro switches all on one system.
The best way to stop going round in circles is to focus on one small piece of your problem at any one time.
For example write a short program to detect when a microswitch is pressed and print the value to the Serial Monitor.
When that works write a separate short program to make a solenoid move in and out, perhaps once every 2 seconds.
etc etc.
A side benefit is that if you develop your project in stages and have a problem with one small part it will be much easier to get help.
All successful programs are just a collection of small pieces. Look at how the code is built up from pieces in Planning and Implementing a Program. Don't worry at this stage if you can't follow the details - just look at the overall concept.
These links may be of interest
Stepper Motor Basics
Simple Stepper Code
...R
I'm really surprised you're having so much difficulty finding material on Arduinos controlling stepper motors, DC motors, solenoids and reading switches.
Seems to me that 90% of Arduino projects involve one or more of all of those elements. I just googled "arduino stepper motor" and got 9 million hits, the first of which is Arduino's own tutorial.
https://www.arduino.cc/en/tutorial/stepperSpeedControl
You said your project is "very simple" and the guy on YT was only "only taught a very simple system"; I'm not sure what your not finding out there or what you need. Can you be more specific about what the project is supposed to do?
As previously emphasized, do not focus on the pie; focus on the slice of pie. R2's tutorials are worth reading. As a beginner, you should know you can selectively call pieces of code - as opposed to compiling in one (hard to read) loop; this will assist with troubleshooting. See below:
void loop(){
stepper_COUNTERCLOCKWISE();
stepper_CLOCKWISE();
solenoid_ENERGIZED();
solenoid_DEENERGIZE();
passYOURvalue(327);
}
void stepper_COUNTERCLOCKWISE(){
}
void stepper_CLOCKWISE(){
}
void solenoid_ENERGIZED(){
}
void solenoid_DEENERGIZE{
}
void passYOURvalue(int myvalue){
Serial.println(myvalue);
}
Separating your code will expedite troubleshooting.
From one n00bie to another,
-J