first modify your post, select the code part and press the # button so it looks better...
You are mixing up different programming languages ..
The Arduino part is quite straightforward:
(code not compiled or tested)
#define BUTTONS 7
int buttons[BUTTONS] = {2,3,4,5,6,7,8};
void setup()
{
Serial.begin(115200); // PC should match thos speed
Serial.println("-- start -- ");
for (int i=0; i< BUTTONS; i++) pinMode(buttons[i], INPUT);
}
void loop()
{
for (int i=0; i< BUTTONS; i++) if (digitalRead(buttons[i]) == HIGH) Serial.println(i, DEC);
delay(100);
}
Now you have to write code in your fav prog lang to capture the output from the Arduino and display the picture.
Please post your final code when ready.