Author Topic: Arduino  (Read 3880 times)

0 Members and 1 Guest are viewing this topic.

Offline mtc2629Topic starter

  • Contributor
  • Posts: 10
  • Country: 00
Arduino
« on: October 07, 2013, 01:23:46 am »
I just wondering what the code should be using 5 servos and 5 flex sensors can i just copy and paste the code 5 times
 

Online xrunner

  • Super Contributor
  • ***
  • Posts: 7517
  • Country: us
  • hp>Agilent>Keysight>???
Re: Arduino
« Reply #1 on: October 07, 2013, 01:27:48 am »
I just wondering what the code should be using 5 servos and 5 flex sensors can i just copy and paste the code 5 times

Hard to say without a lot more information about the project.  :-//
I told my friends I could teach them to be funny, but they all just laughed at me.
 

Offline pstrag

  • Newbie
  • Posts: 7
  • Country: pl
Re: Arduino
« Reply #2 on: October 07, 2013, 04:13:11 am »
Power of most programming languages is that You can use functions, so You have to write only one"part of code" - function to control servo or flex sensor. In code you made, you have to just use this one function and say which servo you will be talking to at the moment, so you can have many servos connected with not a big increase in program size.
Slawek.
 

Offline Greyersting

  • Regular Contributor
  • *
  • Posts: 76
  • Country: us
  • Electronics noob
Re: Arduino
« Reply #3 on: October 07, 2013, 04:14:26 am »
Can you post exactly what you are trying to do?
Contact-
Greyersting2@gmail.com
 

Offline MrAureliusR

  • Supporter
  • ****
  • Posts: 373
  • Country: ca
Re: Arduino
« Reply #4 on: October 07, 2013, 05:36:14 am »
Can you post exactly what you are trying to do?

He's trying to get 5 posts to enter the contest :palm:
--------------------------------------
Canadian hacker
 

Offline Greyersting

  • Regular Contributor
  • *
  • Posts: 76
  • Country: us
  • Electronics noob
Re: Arduino
« Reply #5 on: October 07, 2013, 05:38:20 am »
Can you post exactly what you are trying to do?

He's trying to get 5 posts to enter the contest :palm:

Were you referring to me or to him?
Contact-
Greyersting2@gmail.com
 

Offline MrAureliusR

  • Supporter
  • ****
  • Posts: 373
  • Country: ca
Re: Arduino
« Reply #6 on: October 07, 2013, 05:39:29 am »
To the OP...  :rant: the forums have been flooded with a bunch of stupid questions and one-liners... I really hope Dave DOES check the posts when the randomizer picks a name with less than say 25 posts...
--------------------------------------
Canadian hacker
 

Offline jakehiltz

  • Contributor
  • Posts: 10
Re: Arduino
« Reply #7 on: October 07, 2013, 05:06:52 pm »
I joined for the contest , BUT I refuse to post stupid comments. If this guy is seriously asking if he can just copy and paste the code 5 times he should really read a little bit more about Arduino.

On the other hand if this is a serious question you should take a look at what you are trying to do ... If you are just trying to run 5 servo motors it should be as simple as declaring each pin and activating each motor...

Your question is so vague its impossible to even know what you want to do...do you know what you want to do?
 

Online xrunner

  • Super Contributor
  • ***
  • Posts: 7517
  • Country: us
  • hp>Agilent>Keysight>???
Re: Arduino
« Reply #8 on: October 07, 2013, 10:02:01 pm »
... can i just copy and paste the code 5 times

Well, I'll give another answer.

Sure. Go ahead and see what happens.  :)
I told my friends I could teach them to be funny, but they all just laughed at me.
 

Offline tehmeme

  • Regular Contributor
  • *
  • Posts: 102
  • Country: gb
Re: Arduino
« Reply #9 on: October 07, 2013, 10:14:54 pm »
... can i just copy and paste the code 5 times

Well, I'll give another answer.

Sure. Go ahead and see what happens.  :)

Irrespective of the ops intentions, this is probably the best answer yet.
Experimentation, the best way to learn. (imo)
 

Offline xstream

  • Newbie
  • Posts: 7
Re: Arduino
« Reply #10 on: October 07, 2013, 11:00:09 pm »
Until some poor soul has to read that code again ;)
No really copy and paste can be an option but for clean code it should never be a good one. Sometimes you have to c&p and change some things each time (that should also not be necessary for well written code) but if it is truly always the same or only some index variable changes you really want to use a loop (just read any tutorial on Arduinos and loops)
 

Offline Rigby

  • Super Contributor
  • ***
  • Posts: 1476
  • Country: us
  • Learning, very new at this. Righteous Asshole, too
Re: Arduino
« Reply #11 on: October 07, 2013, 11:38:10 pm »
just copy and paste the code 5 times

Never a good idea, as it is almost never necessary.  If I knew the language better, I'd be able to say definitively that it isn't, but I don't, so I can't.

Copypasta contributes heavily to overall code stink.
 

Offline idiotsecant

  • Newbie
  • Posts: 8
Re: Arduino
« Reply #12 on: October 09, 2013, 12:29:31 am »
You all laugh but my first experience with pseudo-programming was using autohotkey to make a bot to play a video game I liked when I was a teenager ( says something about the videogame if the funnest way to play it is to make your computer play it for you). I had a function that required ~500 iterations of a function, but I didn't really understand FOR loops so I recreated that functionality with some intense copypasta 500 times. Someone on the forums I proudly posted my script on instructed me on the wonders of branching logic  :palm:
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf