Well what exactly is happening?
We need to know what's going on to help you debug!
One thing I noticed though.. it says the button is attached to pin 7, but in your sketch it's set to pin 2. Which pin do you have the button connected to?
And do you have a pull-up or pull-down resistor on the button?
Also, did you upload the Standard Firmata example to your Arduino? (that's required for that processing sketch, as it's using Firmata)
Thank you for replying. I connected input to pin2, and I did have a pull down resistor, and I tried the code from arduino official website, that one worked pretty well, so I think I use Firmata in a right way. But my code just does not work at all, it shows nothing on my board, the LED never turn on. :(
I connected input to pin2
Input from what?
You need to connect +5 to one leg of the switch. The other leg gets connected to pin2 and to one leg of a resistor. The other leg of the resistor gets connected to ground.
The official website for the button tutorial is just that, only a button tutorial.
To get the button sketch in processing to work in arduino, you’ve got to goto Examples, Firmata, Standard Firmata, then upload that…
Then after you do that, run the processing sketch.