We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexDiscussionExhibition › Hello World Speedometer
Page Index Toggle Pages: 1
Hello World Speedometer (Read 1650 times)
Hello World Speedometer
Feb 9th, 2010, 7:15pm
 
Hi everybody! I'm a total noob to Processing, and I've published my very first project here:

adam.theoherns.com/2010/02/09/simple-speedometer-v1/

My question is about code structure and cleanliness. As I grow and improve the program, I'd like to take advantage of OOP and/or any other organizational standards that would make the code simple and easy to read. Any suggestions for me with regard to my little program? Any advice you've got would be great!

Thanks a ton for a great open-source project, and a great community!
Adam
Re: Hello World Speedometer
Reply #1 - Feb 11th, 2010, 8:23pm
 
Adam -

I'm new here, too. That's a great start (I haven't gotten that far, yet). Still trying to figure out what I want to do. I've always been interested in speech recognition, but I have absolutely zero experience. I guess I have to start somewhere!

Dan
Re: Hello World Speedometer
Reply #2 - Feb 12th, 2010, 4:54am
 
It would be nice to have that window to scroll to the left, while graph scrolls to the right.
Re: Hello World Speedometer
Reply #3 - Feb 12th, 2010, 8:05am
 
Interesting... though I would think you would be better off calculating speed by just counting the "pips" and working out the distance from that?

Then just get your current speed from a set sample length (say, 0.5 second) - that'll be the frequency your display updates. Would be better if you stick more magnets on the wheel.
Re: Hello World Speedometer
Reply #4 - Feb 12th, 2010, 10:42am
 
That very cool - new here as well
Re: Hello World Speedometer
Reply #5 - Feb 12th, 2010, 12:58pm
 
Good advertising for processing : make your ideas living ! <|:-)
Re: Hello World Speedometer
Reply #6 - Feb 12th, 2010, 1:45pm
 
Awesome start!

I'm new here also and trying to figure out what I want to do first.

What a great community
Re: Hello World Speedometer
Reply #7 - Feb 13th, 2010, 1:14am
 
This is a really good start indeed. You could embed some parts of your code into classes, to make the whole thing easier to read.

What I like to do is writing the result I expect, then build the OOP skeleton around it (I also like to separate calculation and drawing in the draw() method, but you did that already).

I would expect something like this maybe :
Code:
void draw() {
 
 // measures
 bike.watch();
 timer.tick();
 
 // drawing
 background(255);
 Graph graph = bike.getGraph();
 graph.display();
 Stats stats = bike.getStats();
 stats.display();
 timer.display();
 
}
Page Index Toggle Pages: 1