Thread: MPH code?
View Single Post
Old 12-08-2011, 10:15 PM   #7 (permalink)
dcb
needs more cowbell
 
dcb's Avatar
 
Join Date: Feb 2008
Location:
Posts: 5,038

pimp mobile - '81 suzuki gs 250 t
90 day: 96.29 mpg (US)

schnitzel - '01 Volkswagen Golf TDI
90 day: 53.56 mpg (US)
Thanks: 158
Thanked 267 Times in 210 Posts
simple block code can be like

top:
poll for a pulse
start counting
poll for another pulse (while counting)
stop counting
compute mph from the count
do something with the mph
goto top

this won't track distance precisely, but with a hall effect vss it will give a snapshot of your speed every loop (with a reed switch you will be all over the place). This is the sort of thing arduino users do, and it has severe limitations, but is good for what you describe maybe.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
  Reply With Quote