So I'm a total n00b at this. I'm a final year product design student, getting to grips with Arduino and processing so go easy please :) (however I'm not new to forums so if I've broken any rules or warrant any forum abuse - let loose)
I've tried a couple of searches (see not new to forums) and I can't seem to find anything on this. I basically want the outcome of a switch on my arduino to be able to be read in processing - i.e. if switch = HIGH processing writes "Yes", if switch = LOW processing writes "No."
Is this even possible? I've come across numerous threads making processing buttons that turn on LED's but this is kind of the inverse?
My Arduino is a Duemilanove, and my knowledge is basic but as I said, I'm a student so I'll be doing this full time so will hopefully get to grips in the next few weeks.
s this even possible?
Yes. You could look at Firmata, to be able to ask the Arduino whether the pin is HIGH or LOW. There seem to be some issues with some of the Firmata sketches and various operating systems and versions of Arduino, but you may get lucky and it will work.
Or, and I prefer this method, you could write your own protocol. The Processing sketch could send, for example, <R D 2> (Read Digital pin2). The Arduino would see that there was serial data, read it all, and parse the request. It would then respond appropriately. “Tuesday” probably isn’t appropriate, but you can probably figure out what would be.
Alternatively, the Arduino could simply tell Processing about every change that it detects. On every pass through loop, it would read all the pins, and, whenever one changed, send Processing a message “Hey, pin 2 changed to HIGH” (or maybe something simpler to parse in Processing).