Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: Need Help! on: April 30, 2011, 03:45:00 am
http://arduino.cc/forum/index.php/topic,59925.msg431852.html#msg431852
2  Using Arduino / Programming Questions / Digital imput via arduino to processing on: April 30, 2011, 03:37:04 am
Processing code:

import processing.serial.*;

Serial myPort;  // Create object from Serial class
int val;      // Data received from the serial port

void setup()
{
  size(200, 200);
  // I know that the first port in the serial list on my mac
  // is always my  FTDI adaptor, so I open Serial.list()[0].
  // On Windows machines, this generally opens COM1.
  // Open whatever port is the one you're using.
  String portName = Serial.list()[0];
  myPort = new Serial(this, portName, 9600);
}

void draw()
{
  if ( myPort.available() > 0) {  // If data is available,
    val = myPort.read();         // read it and store it in val
  }
  background(255);             // Set background to white
  if (val == 2) {              // If the serial value is 2,
    fill(0);                   // set fill to black
  
} else if (val == 1) {
    fill (204);
} else {                      
    fill (204, 102, 0);              
  
} rect(50, 50, 100, 100);
}

//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Arduino code:

// Wiring / Arduino Code
// Code for sensing a switch status and writing the value to the serial port.

int switchPin = 4;     // Switch connected to pin 4
int ZZZZ = 7;   // Switch connected to pin 7

void setup() {
  pinMode(switchPin, INPUT);  
pinMode(ZZZZ, INPUT);  
  Serial.begin(9600);                    // Start serial communication at 9600 bps
}

void loop() {
  
  if (digitalRead(switchPin) == HIGH) {  // If switch is ON,
    Serial.print(1, BYTE);               // send 1 to Processing
  } else {                               // If the switch is not ON,
    Serial.print(0, BYTE);               // send 0 to Processing
  }

if (digitalRead(ZZZZ) == HIGH) {  // If switch is ON,
    Serial.print(2, BYTE);               // send 2 to Processing
  } else {                               // If the switch is not ON,
    Serial.print(0, BYTE);               // send 0 to Processing
  }
  delay(100);                            // Wait 100 milliseconds
}

Do not workink good. I did mistake in arduino code , but i do not now there. Please help.
3  Using Arduino / Programming Questions / Processing&Arduino, need change input prom processing to arduino on: April 29, 2011, 11:38:01 pm
void keyPressed() {
 
   if(key == 'r')
     item.startRecording();
     
   if(key == 's')
     item.stopRecording();
}

Here is processing code for start and finish sound recording. How me do it with arduino ?
4  Using Arduino / Programming Questions / Re: Processing & aduino button input code on: April 29, 2011, 11:12:11 am
processing code is here : https://rapidshare.com/files/459673763/Mill_s.zip , but me need write arduino code
5  Using Arduino / Programming Questions / Re: Processing & aduino button input code on: April 29, 2011, 10:53:24 am
I tryed this, but not working
: // pushbutton sender

int pbutton = 7;
int lbutton = 8;
int value = 0;




void setup()
{
  pinMode(pbutton, INPUT);
  Serial.begin(9600);
}

void loop()
{
  value = digitalRead(pbutton);
 if (value == HIGH)
  {
    Serial.println("1");
  }
 
   value = digitalRead(lbutton);
   if (value == HIGH)
  {
    Serial.println("0");
  }
}

and writing: java.lang.StringIndexOutOfBoundsException: String index out of range: -2
java.lang.StringIndexOutOfBoundsException: String index out of range: -2
java.lang.StringIndexOutOfBoundsException: String index out of range: -2
java.lang.StringIndexOutOfBoundsException: String index out of range: -2
6  Using Arduino / Programming Questions / Re: Processing & aduino button input code on: April 29, 2011, 12:01:26 am
who can help me. If you want i can take more information
7  Using Arduino / Programming Questions / Processing & aduino button input code on: April 28, 2011, 04:54:28 pm
Me need a little help with arduino. https://rapidshare.com/files/459673763/Mill_s.zip - here is processing code . Prosessing  working it together with Procesing per serial port. Problem -  I lose aduino code. Who can help write it code. I am bigner in programming.  In arduino is just button input. And all program is similar to this : http://www.geschoir.de/ coffee flourmill.
Pages: [1]