Home \ Help \ Search \ Login RSS

Welcome, Guest. Please Login

This forum is now READ-ONLY! Please visit http://forum.wiring.co/ for the new forum.

Wiring ForumProgramming Questions & HelpSyntax › internal interrupts?

Page Index Toggle Pages: 1
internal interrupts? (Read 3785 times)
12/22/06 at 04:43:04

CSMotionControl   Offline
YaBB Newbies
Hey, did you get any mail
for Willie Nelson?

Posts: 16
Hey All,

I am relatively new to the Wiring board experience, but I'm having a blast with it at the moment.  

One of the things I'd really like to do is use an internal interrupt to control my sampling rate (and more specifically, integration period) for some gyro rate data I am collecting.  Guesstimate reiteration time in the 10ms to 100us range?

Any ideas?  

I haven't looked much yet at the available libraries (read: relatively inexperienced with), but thought modifying some of the PWM libraries might be promising?

Thanks Everybody, in advance.
IP Logged
Reply #1 - 12/22/06 at 09:26:32

barragan   Offline
YaBB Administrator

Posts: 939
hi, this could be done with a program like this:

long lastread = 0;

void setup() {
  pinMode(48, OUTPUT);
  digitalWrite(48, HIGH);

void loop() {
  if((millis()-lastread) > 10) {  // sample every 10ms
    lastread = millis();
    // sample my stuff here

IP Logged
Page Index Toggle Pages: 1