Pages: [1]   Go Down
Author Topic: Processing & aduino button input code  (Read 807 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

who can help me. If you want i can take more information
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 240
Posts: 24450
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That's not Processing code - that's Arduino.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

processing code is here : https://rapidshare.com/files/459673763/Mill_s.zip , but me need write arduino code
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 240
Posts: 24450
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There's nothing wrong with the Arduino code you posted.

What's the problem?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 240
Posts: 24450
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The code you posted compiles.
It is missing a pinMode for lbutton, but beyond that, I can't see very much wrong with it, that a pull-up or pull-down would not cure.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 240
Posts: 24450
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
const int pbutton = 7;
const int lbutton = 8;

void setup()
{
  pinMode(pbutton, INPUT);
  pinMode(lbutton, INPUT);
  // maybe enable the pull-ups here
  Serial.begin(9600);
}

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

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

'round the world...
Offline Offline
Faraday Member
**
Karma: 41
Posts: 3113
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I think a little english lessons are in order here.  smiley-roll

I read through this and couldn't figure out what you wanted.
Logged

Eu não sou o teu criado. Se respondo no fórum é para ajudar todos mediante a minha disponibilidade e disposição. Responder por mensagem pessoal iria contra o propósito do fórum e por isso evito-o.
Se realmente pretendes que eu te ajude por mensagem pessoal, então podemos chegar a um acordo e contrato onde me pagas pela ajuda que eu fornecer e poderás então definir os termos de confidencialidade do meu serviço. De forma contrária toda e qualquer ajuda que eu der tem de ser visível a todos os participantes do fórum (será boa ideia, veres o significado da palavra fórum).
Nota também que eu não me responsabilizo por parvoíces escritas neste espaço pelo que se vais seguir algo dito por mim, entende que o farás por tua conta e risco.

Dito isto, mensagens pessoais só se forem pessoais, ou seja, se já interagimos de alguma forma no passado ou se me pretendes convidar para uma churrascada com cerveja (paga por ti, obviamente).

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 240
Posts: 24450
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What is wrong with the Arduino code?

I don't want to sound repetitive, but you're the one with the hardware, so tell us what you think isn't working.

Tell us what you think "working" means, and how what you observe is different from that definition.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Pages: [1]   Go Up
Jump to: