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.
who can help me. If you want i can take more information
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
That's not Processing code - that's Arduino.
processing code is here : https://rapidshare.com/files/459673763/Mill_s.zip , but me need write arduino code
There's nothing wrong with the Arduino code you posted.
What's the problem?
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.
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");
}
}
I think a little english lessons are in order here. ![]()
I read through this and couldn't figure out what you wanted.
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.