Go Down

Topic: 2 Sensor and 2 Stepper motor and a lcd display  (Read 287 times) previous topic - next topic

yukerevange1

HI GUYS CAN ANYONE CAN HELP 
ME WITH THE CODE ,
   
SO THE THING IS I WANT A CODE THAT IS,THERE WILL BE 2 SENSOR FOR 2 STEPPER MOTOR AND 
   A LCD DISPLAY THAT SHOW THE STEPS OF THE MOTOR .....THAT ALL GUYS PLEASE HELP ME WITH 
   THIS.. 
             AND I AM JUST A BEINNER IN ARDUINO CODEING SO PLEASE HELP ME 
             WITH THIS ???
               

THANKYOU
YUVA

UKHeliBob

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

TomGeorge

#2
Jan 11, 2021, 12:57 pm Last Edit: Jan 11, 2021, 12:58 pm by TomGeorge
Hi,
Welcome to the forum.

Please read http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Please write your posts in lower case.
UPPER CASE MEANS YOU ARE SHOUTING... :) :)

What do you want the stepper motors to do?

Can you please tell us your electronics, programming, arduino, hardware experience?

Thanks.. Tom.. :)
Everything runs on smoke, let the smoke out, it stops running....


StefanL38

Hi Yuva,

writing in CAPITAL letters is interpreted as shouting. Which is pretty unpollite. 

You seem to have a wrong imagination fof how coding works.
It does not work that way

"Hey Alexa order the same Pizza as I ordered on friday"

I want to describe programming with an analogon:

programming is like using Lego. 
Now there are different kinds of Lego
Lego-Duplo
Lego-classic
Lego-technic

Lego-Duplo is for very young childs and pretty easy to use. For building easy and more rough-shaped things.
Nontheless you could build up pretty massive things if you take a lot of Lego-bricks

If you want it to look smarter you would use Lego-classic
If you want much more functionality you would use lego-technic
And of course you can use any combination of them.

Now programming is even more
It is like all kinds of lego, metal construction kits, plaster, silicon for joints, screws and nuts of all sizes
glue, clay etc. etc. etc.

With this set of material you can create a lot of functionality (at least when you are McGuiver) 
Similiar thing with programming
You can do easy things like with a few Lego-Duplo-bricks or high functional things using a bigger set of components
than just Lego-Duplo

So if you want to have real quick success go splitting wood. If you want to program there is a learning-process that take some time. You can have a lot of fun running up the learning-curve. Let an LED blink as a first step into programming.

For two stepper-motors and two sensors you have to take time to analyse and the describe in the forum
-what kind of stepper-motor?
- what kind of stepper-motor-driver?
- what kind of sensors?

So at first you have to make a fundamental decision:
investing 20 to 50 hours in learning the basics of programming
or
....
....
....
not!

Not would mean to abandon the project right now!
There is nothing inbetween except maybe a online found program that has similar words in the description
downloading it trying to upload into your microcontroller and then beeing lost again because you don't understand anything
trying to get help with asking for code just getting answers "post your own attempt".

So it is up to you to decide....

any newbee can apply the most professional habit right from the start:
 add only ONE thing at a time. Debug that ONE thing until that ONE thing works reliable - repeat.
Newbee: become a professional by following this rule.

StefanL38

You have decided to try to get some user here to write the code for you.

you did not yet understand how this forum works.

to say it very clear:

YOU the thread-opener has to post at least a first small attempt of SELFWRITTEN code how it might work.
And ask a SPECIFIC question about one of the DETAILS how to proceed.

or as an alternative to ask for a link to a tutorial to learn YOURSELF  programming this functionality .

In the meantime of waiting for an answer you should transform the waiting-time into getting productive by 
learning programming in general  

Take a look into this tutorial:
Arduino Programming Course

It is easy to understand and has a good mixture between explaining important concepts and example-codes to get you going. So give it a try and report your opinion about this tutorial.

There is another option:

read it to the end before you take action on this:

report to a moderator to move your thread to the gigs and collaboration-subforum 
and ask there if somebody will write the code for beeing PAID MONEY for writing the code for you.

So your opportunities are:
- taking time to learn programming
or 
- taking time to work on whatever job to earn the money for paying the programmer

best regards Stefan
any newbee can apply the most professional habit right from the start:
 add only ONE thing at a time. Debug that ONE thing until that ONE thing works reliable - repeat.
Newbee: become a professional by following this rule.

StefanL38

as an addition:

posting this really poor description
Quote
The material I have to use in this project is 
1) Stepper Motor(2)
2) Lcd display 
3)Please this image os sensor (2): https://encrypted-tbn1.gstatic.com/shopping?q=tbn:ANd9GcRyWTHzZjj9DR7tKNuVLDgw5IbtFa12N9HhX1svH-B2tRluiMWSivnrK4SkG0uurThQjqH9RbLjdTwKoy0nKEbyk8ACbSyvAY1EsWqfIsdpMs9u1qmVXpRY&usqp=CAE
and a non-functional link to a WhatsApp-picture creates an impression that you are

a: somebody who has no idea what kind of work a project like this includes:
analysing datasheets to obtain the details how to write the code for this specific hardware. 

b: a guy who is lazy and wants others to do 98% of HIS work

So the bare minimum is to provide WORKING links where DATASHEETS of the sensor 
and WORKING links of the technical specs of the stepmotor and the stepmotor-DRIVER 

I assume this was not your intention. my position is: I have given enough hints how  to change the picture of yourself to the forum.

best regards Stefan 
any newbee can apply the most professional habit right from the start:
 add only ONE thing at a time. Debug that ONE thing until that ONE thing works reliable - repeat.
Newbee: become a professional by following this rule.

TomGeorge

Hi,
PLEASE READ the first paragraph of POST #2.

Attach any images and the forum editor will load them into your post.

The sensor is a photo-interrupter.

Thanks.. Tom.. :)  

Everything runs on smoke, let the smoke out, it stops running....

yukerevange1

Code: [Select]
// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7,8,9,10,11,12);

int potPin1 = A1;
int potPin2 = A2;

void setup()
{
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.clear();

pinMode(potPin1, INPUT);
pinMode(potPin2, INPUT);
}

void loop()
{
lcd.setCursor(0,0); // Sets the cursor to col 0 and row 0
lcd.print("SensorVal1: "); // Prints Sensor Val: to LCD
lcd.print(analogRead(potPin1)); // Prints value on Potpin1 to LCD
lcd.setCursor(0,1); // Sets the cursor to col 1 and row 0
lcd.print("SensorVal2: "); // Prints Sensor Val: to LCD
lcd.print(analogRead(potPin2)); // Prints value on Potpin1 to LCD
}

Hi guys  this code
so i need to add an two sensor and 2 motor 
but i did the code already but thats ony motor and sensor 
i dont know to how to add two motors and sensors in one project

StefanL38

#9
Jan 16, 2021, 09:05 am Last Edit: Jan 16, 2021, 09:06 am by StefanL38
My impression that you are someone who is lazy solidifies.

The code above is for sure found somewhere online and you did just a quick copy and paste.
This code has nothing at all about stepper-motors

Your posting can be translated into:

I'm really lazy!!! here is some code !! write me the code I have asked for and HURRY UP!!!

no no no no no no no no no no

That is NOT the way this forum works.
I'm curious how many posts it will take until you learn to put REAL OWN EFFORT into this project.

The only help you will get from me is a step by step manual how to put OWN EFFORT into this project:

STEP1: Post a link to a datasheet of your stepper-motors.   Not pictures. A datasheet!

STEP2: Post a link to a datasheet of your sesnors.   Not pictures. A datasheet!

STEP3: do a google search with the keywords "Arduino stepper library" and post those three links
you think were the most useful links combined with the question

After posting this in the meantime of waiting for an answer start to work through this
Take a look into this tutorial:

Arduino Programming Course

It is easy to understand and has a good mixture between explaining important concepts and example-codes to get you going. So give it a try and report your opinion about this tutorial.

best regards Stefan
any newbee can apply the most professional habit right from the start:
 add only ONE thing at a time. Debug that ONE thing until that ONE thing works reliable - repeat.
Newbee: become a professional by following this rule.

yukerevange1


yukerevange1

 :( worst, I did not ask for the code guys 
I just asked what to do when I need to add an extra motor and sensor 


StefanL38

My impression that you are someone who is lazy solidifies

Your posting can be translated into:

I'm really lazy!!! here is some code !! write me the code I have asked for and HURRY UP!!!


:smiley-confuse: :smiley-confuse: :smiley-confuse:

I thought you guys would help how to this 
but I think this not 
even these two  guys are
 better 


sugazax and TomGeorge



thanks to
sugazax and TomGeorge and also StefanL38 

StefanL38

The code you have posted does not even have a first stepper-motor.
I still have the impression that you know almost nothing about programming.
If you would know something about programming you would have been able to post a code that does have at least something about a single stepper-motor.

I'm sure you know how to use google.

Here is a screenshot of how to search for an example-demo-code about stepper-motors

I guess your picture of how programming works is:

add 5 to 10 lines of code and everything is working.

If it would be that easy somebody would have posted the ten lines of code.
But it isn't that easy.

I write programs for 37 years know. So you can really believe me from this experience.
If somebody would post a part of the code that you need you would compile and upload it
and it might work but then you would come back after 15 minutes to ask the next question
Now how do i....
short answer with a piece of code
then you have the next question how do i ...
short answer with a piece of code
...   ...    ...    ....   ....   ....   ...
and this process would go on for 8 to 12 weeks!  You understand 12*7 = 84 days = 3 months.

and still after all this time if you want a tiny change in your program you would still only know tooo less 
to do the change yourself.

The alternative is to take 5 to 10 days each at 5 hours a day to learn programming yourself
and having the project finished in just 3 weeks.  

So it is up to you to decide....
best regards Stefan 

any newbee can apply the most professional habit right from the start:
 add only ONE thing at a time. Debug that ONE thing until that ONE thing works reliable - repeat.
Newbee: become a professional by following this rule.

yukerevange1

HI 



I could like to add a potentiometer to this code but I don't know how to, can please help me.
I have searched with google, yeah its there but I want to add this to this code because to make this code correct 
it took me a day so the potentiometer just adjust the speed, so please give me an idea 
thankyou
I did something wrong please tell me 
here are the photos 



yukerevange1

Code: [Select]
void setup() {
  // Sets the two pins as Outputs
  pinMode(stepPin,OUTPUT);
  pinMode(dirPin,OUTPUT);
}

void loop() {
  // read the sensor value:
  int sensorReading = analogRead(SPEED_CONTROL);
  // map it to a range from 0 to 100:
  int motorSpeed = map(sensorReading, 0, 1024, 0, 100);
  // set the motor speed:
  if (motorSpeed > 0) {
    stepper_NEMA17.setSpeed(motorSpeed);
    // step 1/100 of a revolution:
    stepper_NEMA17.step(STEPS_PER_REV / 100);
      for(int x = 0; x < 1000; x++) {
    digitalWrite(stepPin,HIGH);
    delayMicroseconds(500);
    digitalWrite(stepPin,LOW);
    delayMicroseconds(500);
   }
  }
}


here the code sir, sorry I did not attach it there 

thankyou sir

please help

Go Up