need help under standing my code

how do i declare analog sensors? i get this error when running. code is on the bottem

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: "Arduino Uno"
sketch_jan21a.ino: In function 'void setup()':
sketch_jan21a:8: error: 'sensor0' was not declared in this scope
sketch_jan21a:8: error: 'AnalogRead' was not declared in this scope
sketch_jan21a:8: error: 'sensor5' was not declared in this scope
sketch_jan21a:10: error: 'sensor1' was not declared in this scope
sketch_jan21a:12: error: 'serial0' was not declared in this scope
sketch_jan21a:17: error: 'sensor2' was not declared in this scope
sketch_jan21a:19: error: 'serial0' was not declared in this scope
sketch_jan21a:24: error: 'sensor3' was not declared in this scope
sketch_jan21a:26: error: 'serial0' was not declared in this scope
sketch_jan21a:37: error: 'sensor4' was not declared in this scope
sketch_jan21a:39: error: 'sensor1' was not declared in this scope
sketch_jan21a:41: error: 'serial0' was not declared in this scope
sketch_jan21a:46: error: 'sensor2' was not declared in this scope
sketch_jan21a:48: error: 'serial0' was not declared in this scope
sketch_jan21a:53: error: 'sensor3' was not declared in this scope
sketch_jan21a:55: error: 'serial0' was not declared in this scope
sketch_jan21a:68: error: 'sensor1' was not declared in this scope
sketch_jan21a:70: error: 'serial0' was not declared in this scope
sketch_jan21a:75: error: 'sensor2' was not declared in this scope
sketch_jan21a:77: error: 'serial0' was not declared in this scope
sketch_jan21a:82: error: 'sensor3' was not declared in this scope
sketch_jan21a:84: error: 'serial0' was not declared in this scope
test.ino: In function 'void setup()':
test:18: error: redefinition of 'void setup()'
sketch_jan21a:4: error: 'void setup()' previously defined here
test.ino: In function 'void loop()':
test:24: error: redefinition of 'void loop()'
sketch_jan21a:102: error: 'void loop()' previously defined here

#include <mbq.h>
#include <PingIRReceiver.h>

void setup()
{
goto red;
red:
if((AnalogRead(sensor0)!=AnalogRead(sensor5)))
{
if(((int)(AnalogRead(sensor1))==(int)(AnalogRead(sensor0))))
{
serial0.println(1);
goto red;
}
else
{
if(((int)(AnalogRead(sensor2))==(int)(AnalogRead(sensor0))))
{
serial0.println(2);
goto red;
}
else
{
if(((int)(AnalogRead(sensor3))==(int)(AnalogRead(sensor0))))
{
serial0.println(3);
goto red;
}
else
{
}
}
}
}
else
{
if((AnalogRead(sensor4)!=AnalogRead(sensor0)))
{
if(((int)(AnalogRead(sensor1))==(int)(AnalogRead(sensor4))))
{
serial0.println(4);
goto red;
}
else
{
if(((int)(AnalogRead(sensor2))==(int)(AnalogRead(sensor4))))
{
serial0.println(5);
goto red;
}
else
{
if(((int)(AnalogRead(sensor3))==(int)(AnalogRead(sensor4))))
{
serial0.println(6);
goto red;
}
else
{
}
}
}
}
else
{
if((AnalogRead(sensor5)!=AnalogRead(sensor0)))
{
if(((int)(AnalogRead(sensor1))==(int)(AnalogRead(sensor5))))
{
serial0.println(7);
goto red;
}
else
{
if(((int)(AnalogRead(sensor2))==(int)(AnalogRead(sensor5))))
{
serial0.println(8);
goto red;
}
else
{
if(((int)(AnalogRead(sensor3))==(int)(AnalogRead(sensor5))))
{
serial0.println(9);
goto red;
}
else
{
goto red;
}
}
}
}
else
{
goto red;
}
}
}
}

void loop()
{
}

Which board is this?

for the sensors you need to add in the global session:

const int sensor4 = 33; // where 33 is the pin number

lose the gotos. let the if do the work.

analogRead.

And code tags, yeah.
We like code tags

uno r3

So, you have Serial, not Serial0.

ime new to programming but i changed the seriel ports
still getting errors
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: "Arduino Uno"
sketch_jan27a.ino: In function 'void setup()':
sketch_jan27a:8: error: 'sensor0' was not declared in this scope
sketch_jan27a:8: error: 'AnalogRead' was not declared in this scope
sketch_jan27a:8: error: 'sensor5' was not declared in this scope
sketch_jan27a:10: error: 'sensor1' was not declared in this scope
sketch_jan27a:12: error: 'serial' was not declared in this scope
sketch_jan27a:17: error: 'sensor2' was not declared in this scope
sketch_jan27a:19: error: 'serial' was not declared in this scope
sketch_jan27a:24: error: 'sensor3' was not declared in this scope
sketch_jan27a:26: error: 'serial' was not declared in this scope
sketch_jan27a:37: error: 'sensor4' was not declared in this scope
sketch_jan27a:39: error: 'sensor1' was not declared in this scope
sketch_jan27a:41: error: 'serial' was not declared in this scope
sketch_jan27a:45: error: 'sensor2' was not declared in this scope
sketch_jan27a:47: error: 'serial' was not declared in this scope
sketch_jan27a:51: error: 'sensor3' was not declared in this scope
sketch_jan27a:53: error: 'serial' was not declared in this scope
sketch_jan27a:65: error: 'sensor1' was not declared in this scope
sketch_jan27a:67: error: 'serial' was not declared in this scope
sketch_jan27a:71: error: 'sensor2' was not declared in this scope
sketch_jan27a:73: error: 'serial' was not declared in this scope
sketch_jan27a:77: error: 'sensor3' was not declared in this scope
sketch_jan27a:79: error: 'serial' was not declared in this scope

As you're new to this I'm going to go against most here by taking your non woking, non compiling code and give you something to start off with.

From what I can make of your code this is what you appear to be trying to accomplish so far as I can tell.

Replace 'REPLACE_WITH_YOUR_ANALOG_PIN_ASSIGNEMENT_HERE' with an actual analog IO pin number and it should compile.

If you don't understand something, ask!!!

Hope this helps.

#include <mbq.h>
#include <PingIRReceiver.h>

const uint8_t   pinSENSOR_0 = REPLACE_WITH_YOUR_ANALOG_PIN_ASSIGNEMENT_HERE;
const uint8_t   pinSENSOR_1 = REPLACE_WITH_YOUR_ANALOG_PIN_ASSIGNEMENT_HERE;
const uint8_t   pinSENSOR_2 = REPLACE_WITH_YOUR_ANALOG_PIN_ASSIGNEMENT_HERE;
const uint8_t   pinSENSOR_3 = REPLACE_WITH_YOUR_ANALOG_PIN_ASSIGNEMENT_HERE;
const uint8_t   pinSENSOR_4 = REPLACE_WITH_YOUR_ANALOG_PIN_ASSIGNEMENT_HERE;
const uint8_t   pinSENSOR_5 = REPLACE_WITH_YOUR_ANALOG_PIN_ASSIGNEMENT_HERE;

void subroutine()
{
    int     data;

    if (    (data = analogRead(pinSENSOR_0)) != analogRead(pinSENSOR_5) )
    {
        if      ( data == analogRead(pinSENSOR_1) )
        {
            Serial.println(1);
        }
        else if ( data == analogRead(pinSENSOR_2) )
        {
            Serial.println(2);
        }
        else if ( data == analogRead(pinSENSOR_3) )
        {
            Serial.println(3);
        }
    }
    else if ( (data = analogRead(pinSENSOR_4)) != analogRead(pinSENSOR_0) )
    {
        if      ( data == analogRead(pinSENSOR_1) )
        {
            Serial.println(4);
        }
        else if ( data == analogRead(pinSENSOR_2) )
        {
            Serial.println(5);
        }
        else if ( data == analogRead(pinSENSOR_3) )
        {
            Serial.println(6);
        }
    }
    else if ( (data = analogRead(pinSENSOR_5)) != analogRead(pinSENSOR_0) )
    {
        if      ( data == analogRead(pinSENSOR_1) )
        {
            Serial.println(7);
        }
        else if ( data == analogRead(pinSENSOR_2) )
        {
            Serial.println(8);
        }
        else if ( data == analogRead(pinSENSOR_3) )
        {
            Serial.println(9);
        }
    }
}

void loop()
{   }

void setup()
{
    while ( true )
    {
        subroutine();
    }
}

so wat do i put const uint8_t pinSENSOR_0 =0, Pin.AIN:

yousakicheang:
so wat do i put const uint8_t pinSENSOR_0 =0, Pin.AIN:

No just the pin number:

const uint8_t pinSENSOR_0 = 0;

The semicolon is important, not a colon.

Also note my use of code tags to put it in the nice little block. Try the button above where you type that looks like </>

i still get errors :cry: This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: "Arduino Uno"
sketch_jan27a.ino: In function 'void subroutine()':
sketch_jan27a:16: error: 'AnalogRead' was not declared in this scope

C++ is case sensitive. It's analogRead.

My mistake, I forgot to copy my last edit before posting!