for loops

Hi my names Jackson I am fairly new to this forum, sorry if I am not in the right topic.

Background- I am new to arduino, but I do know a fair bit of java. This program is meant to take a digit and blink the length of the number. For example 3458 should blink 4 times.

My problem- the program blinks 4 times no matter what digit I use.

Thank you for your help

sketch_nov11a.ino (659 Bytes)

  int amountDigits; // represents the length of digit

Because amountDigits is a local variable it will be initialised to an unknown value unless you set it expressly

Is the program calculating amountDigits correctly ? Have you tried printing it ?

  digitalWrite(12, 5); // indicates the program has began

Why the screwy value written to the pin ? Normally you would write HIGH or LOW

Thank you, that fixed it.

Is there any reason that arduino uses high and low rather than a numeric value?

HIGH and LOW are simply definitions made for easier understanding. HIGH is defined as 1, LOW as 0. You can use either,

Jaxliam1921:
Thank you, that fixed it.

Is there any reason that arduino uses high and low rather than a numeric value?

Do you believe a digital output pin can output a "numeric value"? It can't. A digital output can be either HIGH (which is #defined as 1) or LOW (which is #defined as LOW). Seems perfectly logical to me.... What would you imagine it should do when you try to digitalWrite "5"??
Regards,
Ray L.