Some buttons in one integer Pin ?

Is that possible ? To save bits and processing power.

What is a interger pin? Do you mean a digital one?
As it only reads zero or one you can only measure multiple push switches if you AND or OR them together, ther can be no distinguishing individual switches.

example of 8 switches using one byte to store their states:

int ledPin[8] = {10,11,12,13,A0,A1,A2,A3};
int buttonPin[8] = {2,3,4,5,6,7,8,9};

byte switchState = 0b00000000;
byte lastByte;

void setup()  
{
  Serial.begin(115200);
  for (byte i = 0; i < 8; i++)
  {
    pinMode(buttonPin[i], INPUT_PULLUP);
    pinMode(ledPin[i], OUTPUT);
  }
}

void loop()  
{
  for (byte i = 0; i < 8; i++)
  {
    bitWrite(switchState, i, digitalRead(buttonPin[i]));
  }
  for (byte i = 0; i < 8; i++)
  {
    digitalWrite(ledPin[i], bitRead(switchState, i));
  }
  if (lastByte != switchState) 
  {
    printMyByte(switchState);
  }
  lastByte = switchState;
}

void printMyByte(byte myByte)// prints leading zeroes
{
  for (byte i = 0; i < 8; i++)
  {
    Serial.print(bitRead(switchState, 7 - i));
  }
  Serial.println("");
}

I'm not sure what you're trying to achieve. If you simply want to read 8 inputs as a single byte (using each bit to store the digital state of a single button) You select your pins carefully then you can use direct port access.

For Example, using pins 8,9,10,11,12,13,14,15 You could then use the following

DDRB= 0;                      //sets all 8 bits to input
byte result = PINB;   // reads pins into the variable "result"


//To send a complete byte out
DDRB= B11111111;         //sets all 8 bits to output
PORTB = newValue;;     //sends the 8 bits  to the pins

Use my previous thread instead here.

GFS wonders where he put the mind reading hardware and sketch.

Qwseyvnd:
Use my previous thread instead here.

No, I don't want to I've done my bit already:p

One array with 20, 3, 5, 5, 4, 4, 6, 4.
Now I see that it is possible, thank you.
I don't want to use a lot of memory which needs more RAM usage.

I will making a navigator panel to my hobby ilyushin il-62, so I need to use least as possible memory.
I have one MEGA2560, which will be used for led diode, toggle switches, rotary encoders, and one DUE to run stepper motors and calculate math.

Qwseyvnd:
One array with 20, 3, 5, 5, 4, 4, 6, 4.
Now I see that it is possible, thank you.
I don't want to use a lot of memory which needs more RAM usage.

I will making a navigator panel to my hobby ilyushin il-62, so I need to use least as possible memory.
I have one MEGA2560, which will be used for led diode, toggle switches, rotary encoders, and one DUE to run stepper motors and calculate math.

Is there any reason you can't change the pins you're using? Could make for more efficient code.

Of course I can change pins.

Qwseyvnd:
Of course I can change pins.

Great idea. Then you can use the method I described above.

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(xxxx,, yyyyy, zzzz, aaaaa, INPUT);
pinMode(bbbb, ccccc, ddddd, eeee, OUTPUT);
}

Is that possible ?

Qwseyvnd:
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(xxxx,, yyyyy, zzzz, aaaaa, INPUT);
pinMode(bbbb, ccccc, ddddd, eeee, OUTPUT);
}

Is that possible ?

I don't think you're paying attention.

OK.

Now I am trying to do so that the arduino card receive bytes from x-plane 10 data which is just speed and heading, and magnetic variation, to start with.

How does the x-plane send this data?

Qwseyvnd:
OK.

Now I am trying to do so that the arduino card receive bytes from x-plane 10 data which is just speed and heading, and magnetic variation, to start with.

Maybe you should try simple things until you know what you're doing and then start to learn.

No, you don't know. You showed that already with this.

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(xxxx,, yyyyy, zzzz, aaaaa, INPUT);
pinMode(bbbb, ccccc, ddddd, eeee, OUTPUT);
}

Is that possible ?

You don't know the simple things but you can learn. Take the time and you will become good and interface with your flight sims.

BTW, what is IL-62? I know of IL-2 Sturmovik from Oleg Maddox in Moscow, is it that? For that you need to get through devicelink which will take some network code on the PC as well... unless you use a Leonardo or like to send the PC keyboard, mouse and stick inputs which is much easier and will work online as well as offline.

With SDK and DataRef, through plugin that I must programming at my fingers; then, communicate to RS232 which is on Arduino MEGA2560.

GoForSmoke:

Qwseyvnd:
OK.

Now I am trying to do so that the arduino card receive bytes from x-plane 10 data which is just speed and heading, and magnetic variation, to start with.

Maybe you should try simple things until you know what you're doing and then start to learn.

No, you don't know. You showed that already with this.

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(xxxx,, yyyyy, zzzz, aaaaa, INPUT);
pinMode(bbbb, ccccc, ddddd, eeee, OUTPUT);
}

Is that possible ?

You don't know the simple things but you can learn. Take the time and you will become good and interface with your flight sims.

BTW, what is IL-62? I know of IL-2 Sturmovik from Oleg Maddox in Moscow, is it that? For that you need to get through devicelink which will take some network code on the PC as well... unless you use a Leonardo or like to send the PC keyboard, mouse and stick inputs which is much easier and will work online as well as offline.

http://www.google.no/url?sa=i&rct=j&q=&esrc=s&source=images&cd=&cad=rja&uact=8&ved=0CAcQjRw&url=http%3A%2F%2Fwww.airliners.net%2Fphoto%2FAeroflot%2FIlyushin-Il-62%2F1084217%2F&ei=LnFBVMaeKIjiywOMk4KYCA&bvm=bv.77648437,d.bGQ&psig=AFQjCNEL7_CiYgj1c-UAywA7YuKQiWe9qA&ust=1413661349846401
Is is this what I want to building, I think that have enough information.

communicate to RS232 which is on Arduino MEGA2560.

The MEGA does not have RS232 communications, to feed RS232 into a MEGA you have to convert the voltages to TTL.

Is is this what I want to building,

Web site is not in English and just shows a few words, this is not enough for us to see what you want.

I think that have enough information.

No one said you did not have enough information. We said that you had not got enough knowledge of how programming works to do what you want to.

In Linux, MEGA2560 does not shows USB as the connection method, it shows serial.

It is this airplane that I want to build.

After I tried PT Il-62M addon for Flight Simulator 2004, I became motivated to build this.
I have found in avsim.su a documentation 1.500 pages of system and airplane characteristic; which I believe it should be enough.

You have right that I have not enough knowledge programming, but I am trying to double-learn

Maybe I should trying simpler; making a fuel tank gauge ?