iso error

hi can anyone explain why i am having this error

int segmentPin = {2,3,4,5,6,7,8,9};
int displayPin = {10,11,12};

byte One =
{
B01100000};

byte Two=
{
B10001010};

void setup()
{
for (int i=0; i <8; i++)
pinMode(segmentPin*, OUTPUT);*

  • for (int i= 0; i <3; i++)*
    _ pinMode (displayPin*, OUTPUT);_
    _
    }*_

_ void loop()
* { displayOne();*
* }*
* void displayOne()*
* {*
* for(int count=0; count <8; count++)*
* {*
* for(int i=0; i<8; i++)*
{ digitalWrite (segmentPin*, LOW);
}
for (int i =0; i<3; i++)
{
digitalWrite(displayPin, HIGH);
}
}
for(int seg=0; seg<8; seg++)
{
int bit = (One[count] >> seg) & 1;
if (bit ==1)
{
digitalWrite(segmentPin[seg], HIGH);
}
}*_

[/quote]
error- name lookup of ‘count’ changed for new ISO ‘for’ scoping

fez016:
hi can anyone explain why i am having this error

error- name lookup of ‘count’ changed for new ISO ‘for’ scoping

First off, I’d suggest cleaning up the indentation (Ctrl+T) in the Arduino IDE :).

The problem you have comes from the declaration of the count variable as a loop condition.

You declare “count” in the for loop:

for(int count=0; count <8; count++)
{
...
}

Then, you use if after the for loop, in the next one:

for(int seg=0; seg<8; seg++)
    {
        int bit = (One[       count      ] >> seg) & 1;

This is not technically allowed since count only exists within the confines of the first for loop.
You can do this to work around it (if that’s really your intent):

int count=0;
for(; count <8; count++)
{
...
}

for(int seg=0; seg<8; seg++)
    {
        int bit = (One[       count      ] >> seg) & 1;

Might I also point out that you have a crash bug in your code that you might want to be aware of:

This piece of code…

byte One[] = { B01100000 };

Declares an array of “byte” elements and initializes it to contain a single element with the value of B01100000.

Then later in this loop:

for(int seg=0; seg<8; seg++)
    {
        int bit = (One[count] >> seg) & 1;
        if (bit ==1)
        {
            digitalWrite(segmentPin[seg], HIGH);
        }
    }

You access the 8th array element in the “One” array. This is a crash bug and probably not your intention.

Just FYI.

oh shoot!! thanks for the help. am sooo green in this :fearful: