I was just polling the pins, so it was triggering repeatedly when a button was pressed, but today at lunch I updated it to use the Bounce library and so it will only register the button once when it is pressed.
I want to clean it up, but,
const int ledPin = 13; const int buttonA = 2; const int buttonB = 3; const int buttonC = 4; const int buttonD = 5; const int buttonY = 6; const int buttonN = 7;
In regard to "Is it possible to have 2 pressed at the same time?" , do you mean, register two simultaneous presses? No, so if buzzers A and B are pressed simultaneously, A will register as the button pressed unless you do it between polling A and B. So there is a slight benefit to being A over B, but also D over A. I calculate that the buttons are being polled at least every 10ms, so I think that is sufficient resolution, at least for my purposes.
I spend part of the summer vacation building a quiz system that I can use in the classroom (I'm a science teacher). The buzzers are basically simple buttons and the processing sketch does most of the work.
Don't know if we can embed youtube but here it is in action: All files are available here.
Anytime I have used pH meters, step #1 was calibrating. If you interpolate between the high pH sensor value and low pH sensor value can you predict what the middle pH sensor value would be? Aka make up your own equation.
With such close pH values in your samples, it is possible the setup is having trouble. It might be worth beginning with detecting pH3 pH10 then going for precision measurements around pH 7
However I would first alter the code to get more consistent readings. I would analog read once each loop, there may be variations between each reading in your loop (i would bet on it). This would cause inconsistent variation between the corrected and uncorrected values.
I would change the code to:
* read the sensor value x 8 * determine the mean sensor value over 8 measurements. * calculate the pH based on the mean sensor value * calculate the temp corrected pH based on the mean sensor value
Also, It might be worth taking more than 8 readings. (say, 80, but only delay 100...?)
The temperature corrected value seems off, your calculation uses 1024 rather than 200.
I've constructed a program using processing which talks to the arduino, and Ideally I would export it as an executable that I could run on other computers besides my own.
The problem is that the total number of serial ports seems to vary in some manner im not aware of, and obviously the settings will vary if i use another computer.
I guess the question is, I am telling processing to look at a specific serial port in a sequence of serial ports (as in hey, look at the third port). Can I tell processing to look at a specific serial port instead (look at COM 7).