[sdiy] Arduino questions

Ian Smith taciturn_unquiet at hotmail.com
Fri May 15 04:40:28 CEST 2009


Thanks guys.  Those were great and fast answers. I just want to clarify to make sure I understand everything correctly. 

Danjel: so something like this-

int potpin = 17; // analog pot to be read for a value between 0-255 (yup, divide by 4 down in the  loop)
int ledpin = 13; // connect LED to pin 13
int buttonpin = 5; // a button for nefarious purposes connected to pin 5 LOW/HIGH choice

jcl:

void setup ()
{}

void loop ()
{

do this
{}

and this
{}

and this one too
{}

// all at the same time and not one after the other?

}

-Ian Smith


> I can answer the first question:
>
> Analog Pin 2 is also Digital pin 17 (not Digital Pin 2). You just keep
> counting from the last digital pin (14) up to 6 past that (since there
> are 6 analog pins). All the port addressing and register stuff is
> taken care of in the libraries.
>
>
> cheers,
> Danjel

>2) Is it possible to run more than one void loop() in the same program.

>
>You can run any number of loops and subroutine calls from inside the main loop(). 
>You can also use interrupts to call other code.
>
>(* jcl *)

> On Thu, May 14, 2009 at 6:54 PM, Ian Smith  wrote:
>>
>> Hey all,
>>
>> ok, well maybe not all... just you Arduino users.
>>
>> I've read the manual and several little programs and I've come up with a couple questions. 1) how does the Arduino know the difference between say Analog pin 2 and Digital pin 2 when it doesn't seem like there's a difference when calling them in the program. 2) Is it possible to run more than one void loop() in the same program.
>>
>> -Ian Smith
>>
>> _________________________________________________________________
>> Hotmail® goes with you.
>> http://windowslive.com/Tutorial/Hotmail/Mobile?ocid=TXT_TAGLM_WL_HM_Tutorial_Mobile1_052009
>> _______________________________________________
>> Synth-diy mailing list
>> Synth-diy at dropmix.xs4all.nl
>> http://dropmix.xs4all.nl/mailman/listinfo/synth-diy
>>
>
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at dropmix.xs4all.nl
> http://dropmix.xs4all.nl/mailman/listinfo/synth-diy

_________________________________________________________________
Insert movie times and more without leaving Hotmail®.
http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009



More information about the Synth-diy mailing list