We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi there!
Im working on a project using an arduino pro mini, and a rotarty potentiometer. Fairly basic hardware. Im familiar with the arduino programming language but new to processing.
What I am trying to accomplish is some data visualization based on the position of the potentiometer.
There are a few parameters/goals that I have set for this.
1.) Range of motion - I'm visualizing this as a pie or doughnut chart. I would like for this to show me where the potentiometer is on a 360 degree diagram.
2.) Counter - I would like to have a number value, starting a 0, increase every time a function has been preformed. Specifically if the potentiometer knob moves from 0 degrees to 90 degrees and back that would mean an increase of 1.
3.) Elapsed time - Just looking to add a timer function to measure the counter function. How long did it take for the user to preform the function.
4.) (Stretch goal) Range field/gamification - The best way I can explain this is that old helicopter game This would use all of the previous functions (angle, counter, time). For example, can you turn the know the right amount at the right speed and back.
I'm hoping that I can build this with your help.
I'm going to build the code using button press initially then when I have the structure down I'll add the Hardware and switch to the hardware integration section.
From there I'm hoping you can send me in the right direction by sending links to how to build this. I've searched the forums but I don't really know what I'm looking for. I have the raw data coming into the serial port in Arduino but I believe the first step is to upload standard firmata onto my arduino.
Thanks for your help!
Answers
I'm starting with the button click and the timer.
I have the counter displayed and i have a print in with the time.
I'd like to have it setup so that if I hold the button for 5 seconds it will register as 1 and increase the number displayed. I would also like to have the time displayed in the frame and see it running rather than have it print in.
here is the code.
Have a global string variable holding the string you format for the
println()
, initialize it to""
, display it indraw()
withtext()
.Also add
start = millis();
at the end ofkeyPressed()
, to reset it for the next key.Ok I seem to have been able to get the time to show up but it is only flashing momentarily and its very large. It is also showing up on the left of the case number.
Any thoughts on how to make it stay until the button is pressed again or how to create a cascading list? here is the code.