im having a problem controlling a stepper motor using a microcontroller..what i did is that i test it with my board coz it has led's to check whether its working or not..we are tasked to make a program in c++ that would make a variable reluctance stepper motor work. If you press the the R button the rotor of the stepper motor will turn forward (clockwise), if you press L it will turn backward (counter clockwise), and if you press S the program will stop.. so how would you be able to make a program out of this conditions?
programmingnoob 0 Light Poster
Recommended Answers
Jump to PostThis looks more like C than C++... Anyway, to be able to do something like you described, you'll need real-time I/O. This isn't supported by standard C/C++, so you'll have to look into your compiler documentation for more information regarding this (or get a third-party library to handle it). Oh, …
Jump to Postvoid main() is fine. There isn't an OS. The code runs in an infinite loop until the power is removed.
Jump to PostWell, like I said, you can't get real time input using standard C. You could, for instance, create a menu for your program:
Please choose an option [B]r[/B]: Move forward 10 rotations [B]l[/B]: Move backwards 10 rotations [B]s[/B]: Exit program Please enter your input:
But it'd always …
Jump to Postuhmm...i dont think we need the menu thing...coz our main output is the stepper motor itself...we are not limited to how many rotations, maybe an infinite rotation or 1 rotation, it doesnt matter..as long as it moves the right way when you press the corresponding button to it... the R, …
Jump to PostWhat code are you using now? Remember to use code tags when posting code.
All 24 Replies
programmingnoob 0 Light Poster
John A 1,896 Vampirical Lurker Team Colleague
programmingnoob 0 Light Poster
Nick Evan 4,005 Industrious Poster Team Colleague Featured Poster
Colin Mac 53 Posting Whiz
programmingnoob 0 Light Poster
Colin Mac 53 Posting Whiz
JRM 107 Practically a Master Poster
programmingnoob 0 Light Poster
programmingnoob 0 Light Poster
John A 1,896 Vampirical Lurker Team Colleague
programmingnoob 0 Light Poster
JRM 107 Practically a Master Poster
John A 1,896 Vampirical Lurker Team Colleague
programmingnoob 0 Light Poster
John A 1,896 Vampirical Lurker Team Colleague
JRM 107 Practically a Master Poster
JRM 107 Practically a Master Poster
programmingnoob 0 Light Poster
programmingnoob 0 Light Poster
JRM 107 Practically a Master Poster
farris 0 Newbie Poster
Yumie_1 0 Newbie Poster
rproffitt 2,706 https://5calls.org Moderator
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.