how do you write a variable!

hello folks

i was wondering how do you write a variable?

my code...........
digitalWrite(ledPin0, HIGH); // sets the LEDS on
delay(490); // waits for a second
digitalWrite(ledPin0, LOW); // sets the LED off
delay(40); // waits for a second

in PHP yuo write a variable like this... $order_by = $_GET['getorder'];
lets say i would like to call the 1st delay1

can i do somthing like this ... $delay1 = delay(490); ???

then do somthing like this

digitalWrite(ledPin0, HIGH); // sets the LEDS on
delay1; // waits for a second
digitalWrite(ledPin0, LOW); // sets the LED off
delay2; // waits for a second >?????????????????????????????

many thanks jason

You can do this:

int delay1 = 490; // declare a variable and set it equal to 490
int delay2; // declare another variable

delay2 = 40; // set the second variable equal to 40

digitalWrite(ledPin0, HIGH); // sets the LEDS on
delay(delay1); // waits for 490 ms
digitalWrite(ledPin0, LOW); // sets the LED off
delay(delay2); // waits for 40 ms

hello folks

i was wondering how do you write a variable?

In C and JAVA (and most other languages) you cannot simply write:

$myVar;

In order for the compilator to see this as a variable. You have to follow this recipie:

// <datatype> [variableName] = value;

int myInteger = 10;

Now, the variable 'myInteger' can only be assigned values that is conform with the definision of an int.
Because it's given the datatype 'int'. [this you'll have too read up on, in the reference]

See here under 'Data Types' Arduino - Home

Thankyou mem that works great

thanks jason