Accelerometer PBASIC Help
Greg S
Posts: 3
Hello-· Working on my first program using PBASIC with BS2.· I have a Hitachi H48C 3-Axis accelerometer attached to the stamp and it is responding based on a simple program I created, but cannot figure out how to do the following which is much more difficult for me:
For a·defined time (30 seconds, 60 seconds, etc.)
Count the number of times the accelerometer sensed a strike during that time
For each strike store in an array the gforce
i need to eventually find the max force and average force - thus the reason I need to store each strike's force and the total number of strikes.· I have sub routines for this math, but getting the strike force into an array for a specific length of time is my problem.
Any suggestions would be appreciated.
Thanks,
GS
For a·defined time (30 seconds, 60 seconds, etc.)
Count the number of times the accelerometer sensed a strike during that time
For each strike store in an array the gforce
i need to eventually find the max force and average force - thus the reason I need to store each strike's force and the total number of strikes.· I have sub routines for this math, but getting the strike force into an array for a specific length of time is my problem.
Any suggestions would be appreciated.
Thanks,
GS
Comments
The Stamp has a very limited amount of storage. If you have more than a few strikes, you won't have room to store the information. It would be better to compute the average and maximum force with each additional strike so you don't have to store all of them.
Thanks for the information.· That certainly does help.· It sounds like I need to rearrange my code for avg and max as well as look into the external clock.· I appreciate your response.
GS
Hope that helps,
Dave
GS
All they said, plus this: The BS2 is the SLOWEST of the modern Stamp family. It executes 4,000 instructions per second. On the other hand, the BS2px is the fastest Stamp. I executes 19,000 instructions per second. I wonder if the increased speed would help in your application?
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.