Reading the Port X times per second

Hello guys,

I'm really new to Arduino. I'm developing a spring that can measure the force applied to it. This spring is now connected to Arduino and I to write a code "F%" everytime I want to read the force I'm applying in that spring. I want that the code "F%" is writen 10 times per second so it is almost constantly and automaticly reading the force. How can I do this?

Thank you very much.

Have a look at the blink without delay example in the IDE examples. That will show how to periodical!y execute a function with out blocking. FILE, Examples, Digital is where it can be found.

The demo Several Things at a Time is an extended example of BWoD. It may help with understanding. Instead of blinking an LED you can take a measurement.

...R

Robin2:
The demo Several Things at a Time is an extended example of BWoD. It may help with understanding. Instead of blinking an LED you can take a measurement.
...R

It's a good example too, Robin. Thanks for taking the time to write it.
I often suggest that people study both "BlinkWithoutDelay" and "Demonstration code for several things at the same time" to get ideas on how to implement 'millis()'-based timing.

A simple solution can be found in ALib0:

every(100) { //10 times per second: every 100ms
 //your code goes here
}

See the #define every(ms) in ALib0.h, how you can write your own code.

First of all, I've never heard of a spring (the mechanical type) can directly connect to an arduino. I imagine you have something electronic interfacing between arduino and the spring. You have to elaborate what it is by posting a link to its manual. Your description is grossly lacking details.

Second, if you want to read something more than once, you have to read more than once. Post your code and someone will tell you how to make it work more than once.

You posted no code, no information regarding the hardware. You must have NOT read "How to use the forum" thread. That's not how you want to raise your first question on a forum.