Show Posts
Pages: [1]
1  Topics / Interactive Art / Re: pushing a button makes appear a picture at the computerscreen on: June 13, 2011, 10:14:20 am
oh thanks, havent seen before that arduino hasnt a display..
but thats exactly i asked for the whole time, how to tell the pc do it...

next try:

now im using python to let the pictures appear and im writing the code in komodo.

def (btn_i):    # picture to show when button pushed
     ....1, DEC = btn_1
import serial

ser = serial.Serial('/dev/ttyUSB0', 9600)

var = 1
while var == 1:
    if ser.inWaiting() > 0:
    if ser.readline == "btn_2":
    form.show_form(placement, bordertype, name)
    //to Show the image?
    //is it possible to hide the image. or is it already included in the arduino code?
    elif ser.readline == "btn_3":
    print-3.jpeg //better just use print?
    elif ser.readline == "btn_4":
    elif ser.readline == "btn_5":
    elif ser.readline == "btn_6":
    elif ser.readline == "btn_7":
    elif ser.readline == "btn_8":
2  Topics / Interactive Art / Re: pushing a button makes appear a picture at the computerscreen on: June 13, 2011, 06:58:51 am
thank you very much robtillaart, the code works better than mine...
doesnt has any errors in arduino.

but i dont understand why you now used a void loop?

is there no way to write a code which makes that, what i wrote earlier?
push one of the buttons - the dedicated pictures comes up, dont press the button anymore - picture disappears.

still dont know how to define the pictures and how to command them.

do  i dont have to convert them?

im studying art not informatics, so already that
"Now you have to write code in your fav prog lang to capture the output from the Arduino and display the picture."
i dont know what to do.

need an explanation step by step...
3  Topics / Interactive Art / pushing a button makes appear a picture at the computerscreen on: June 12, 2011, 06:47:24 pm
hi everyone!
i hope to get help with that, because i quite confused.

i tried do write a code for letting pictures appear at the computerscreen to the activations of pushbuttons. there are 7 pushbottons and each one has its dedicated picture.

but i have several problems:

i dont know how to define the output correctly?

as well i cant say whats the right command for that kind of coding, is it serial.write or serial.print or digital.write... or what else..?

also i dont know if arduino or processing are able to project pictures, so i was looking for an converter and found that:
but its not really working...

im a real beginner!!! bloody beginner! i didnt have problems to modificate the examples but this is beyond me!!

please, could somebody help me out?
have to finish that project this week! :-/


here the code:

// 7 pushbuttons, any of them initiating a picture

 //------------------ATTRIBUT --------------------------------
 // Buttons
 int buttonPin = 0;
 int buttonPin2 = 2;
 int buttonPin3 = 3;
 int buttonPin4 = 4;
 int buttonPin5 = 5;
 int buttonPin6 = 6;
 int buttonPin7 = 7;
 int buttonPin8 = 8;
 // which apparat?

 int pic2 =  2.jpeg;
 int pic3 =  3.jpeg;
 int pic4 =  4.jpeg;
 int pic5 =  5.jpeg;
 int pic6 =  6.jpeg;
 int pic7 =  7.jpeg;
 int pic8 =  8.jpeg;
 // Variable?
 int buttonState = 0;
 // --------------Method to read the buttons--------
  void setup() {
  pinMode(buttonPin2, INPUT);
  pinMode(buttonPin3, INPUT);
  pinMode(buttonPin4, INPUT);
  pinMode(buttonPin5, INPUT);
  pinMode(buttonPin6, INPUT);
  pinMode(buttonPin7, INPUT);
  pinMode(buttonPin8, INPUT);
  pinMode(pic2, OUTPUT);
  pinMode(pic3, OUTPUT);
  pinMode(pic4, OUTPUT);
  pinMode(pic5, OUTPUT);
  pinMode(pic6, OUTPUT);
  pinMode(pic7, OUTPUT);
  pinMode(pic8, OUTPUT);


 void loop() {
  // what method for digitalRead?
   int reading = digitalRead(buttonPin);
   buttonState = digitalRead(buttonPin);

 // says what arduino hace to do, if you are pushing button2
 // better Try {....}  catch {...}?
 // or case0 {...}, case 1...
 if (buttonState "buttonPin2" == HIGH) {
  // method to et the image appear, eg:
  pic2= loadImage ("img/2.jpg");
  // or: Serial.println("img/2.jpg");  ?

  // or: JFrame frame = new JFrame();
            File datei = new File( "2.jpeg" );
            BufferedImage bild =;
            // Bild anzeigen
            JLabel label = new JLabel(new ImageIcon(bild));

 else if (buttonState buttonPin2 == LOW) default;
  // default ending the process, if button no longer is pressed

 else if (buttonState buttonPin3 == HIGH)
 else (buttonState buttonPin8 == LOW) default
hope thats not completly rubbish and it more or less easy to solve... :-/

thanks for commenting!
lkjh smiley
Pages: [1]