Problem with arduino timers

Discussion in 'General Programming Discussion' started by tevko, Mar 10, 2014.

  1. tevko

    tevko New Member

    Joined:
    Mar 10, 2014
    Messages:
    3
    Likes Received:
    0
    Hi!

    I'm trying to create a triac-based light dimmer using udoo arduino. I have successfully implemented a dimmer using delays, but I need to keep my arduino responsive, and thus I need interrupt timers.

    Since (my understanding is that) udoo contains arduino due, I've tried Ivan Seidel's DueTimer-library https://github.com/ivanseidel/DueTimer, but have had no success so far. Even their basic examples don't seem to work. The code hangs, and seems to never return from the setPeriod-function:

    Code:
    Timer3.attachInterrupt(handler).setPeriod(1000)
    Has anyone had any success with udoo arduino timers? Should the due's timer-related functions work with udoo arduino?

    Best,
    Tevko

    Edit: All comments are welcome. It's due, isn't it? All due libraries should work?
     
  2. tevko

    tevko New Member

    Joined:
    Mar 10, 2014
    Messages:
    3
    Likes Received:
    0
    I'll be bypassing this problem by:
    1. Using delays, and thus blocking the serial communications during dimming.
    2. Using one GPIO pin to tell (from linux to) arduino when should stop dimming and listen to serial port.
    The only negative side-effect should be that the dimmed lights go off during serial communications. In my case, this should occur rarely and can usually be timed to happen at night.

    I'm still wondering: Should all arduino due -compatible libraries work with UDOO?
     
  3. mkopack

    mkopack Member

    Joined:
    Jun 14, 2013
    Messages:
    451
    Likes Received:
    21
    They SHOULD.... but that doesn't mean they all will - ie: it is possible that there might be some differences. I've never messed directly with the Arduino Timers... I would suggest maybe doing some small tests of the timer stuff directly yourself before trying to use that library. See if those tests function properly. If they do then it's an issue in that library.
     
  4. tevko

    tevko New Member

    Joined:
    Mar 10, 2014
    Messages:
    3
    Likes Received:
    0
    Thanks for your response, mkopack.

    I'll take a closer look at my timer issue, although not quite yet. My project is a rather large one, and I'll have to get finish the rest of it (since I found an acceptable workaround for this part) before I start improving it.

    Cheers,
    Tevko
     

Share This Page