Go Down

Topic: Processing not receiving from ArduinoBT (Read 325 times) previous topic - next topic

bedu

I have a simple instalation. using Arduino and 5 buttons to send diferente signals to Processing. Processing receives the 1st button pushed, but not the others... Pairing is OK. Uploading to Board seems to be OK. I have a MacBookPro with X.4.11 (Tiger)...

Using the following code (but this works perfectly with Arduino USB..)

========

int val = 0; // Variavel for reading Pin status
int val2 = 0; // Variavel for reading Pin status
int val3 = 0; // Variavel for reading Pin status
int val4 = 0; // Variavel for reading Pin status
int val5 = 0; // Variavel for reading Pin status

int inPin = 8; // Set the Input pin
int inPin2 = 12; // Set the Input pin
int inPin3 = 11; // Set the Input pin
int inPin4 = 10; // Set the Input pin
int inPin5 = 9; // Set the Input pin

int flag;
int flag2 = flag + 1;
int flag3 = flag + 2;
int flag4 = flag + 3;
int flag5 = flag + 4;

void setup() {

 pinMode(inPin,  INPUT); // Set pushbutton as INTPUT
 pinMode(inPin2, INPUT); // Set pushbutton as INTPUT
 pinMode(inPin3, INPUT); // Set pushbutton as INTPUT
 pinMode(inPin4, INPUT); // Set pushbutton as INTPUT
 pinMode(inPin5, INPUT); // Set pushbutton as INTPUT
  Serial.begin(115200);
}

void loop() {
 val = digitalRead(inPin); // read inPut Value
 val2 = digitalRead(inPin2); // read inPut Value
 val3 = digitalRead(inPin3); // read inPut Value
 val4 = digitalRead(inPin4); // read inPut Value
 val5 = digitalRead(inPin5); // read inPut Value

 if(val5 == LOW){
    Serial.print(flag5, BYTE);
 } else
if (val4 == LOW) {
   Serial.print(flag4, BYTE);
 }
 if (val3 == LOW) {
   Serial.print(flag3, BYTE);
 }
 if (val2 == LOW) {
   Serial.print(flag2, BYTE);
 }
 if (val == LOW) {
   Serial.print(flag, BYTE);
 }  
}

========
On Processing I tryed a SimpleRead example to see whats coming in...
Any ideas whats going on?

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy