fade example not working in M4

Discussion in 'UDOO NEO' started by Matt557, Apr 2, 2016.

  1. Matt557

    Matt557 New Member

    Joined:
    Nov 24, 2015
    Messages:
    6
    Likes Received:
    1
    Hello Udooers,

    I tried running the fade example from the Arduino IDE, but it is not working. The blink example works fine, also from the web interface (192.168.7.2) if I click Arduino/Fade/run, it works, but not if I upload the the code from Arduino IDE.
    I observed, that indeed the during the FIRST iteration of the loop function the brightness value is correctly set by the analogWrite function, but all other iterations cause the LED to turn off instead of changing the light intensity. For example I set brightness to 255 and delay(1000), the LED shines 1 second and then turns out. If I leave brightness at 0, it won't shine at all.
    The M4 without working PWM is not very usefull at all...

    Thanks for suggestions!
     
  2. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
  3. Matt557

    Matt557 New Member

    Joined:
    Nov 24, 2015
    Messages:
    6
    Likes Received:
    1
    Hi Walter,
    thx for the information. I tried it and just uncommented the line pinMode(9, OUTPUT) in the fade sketch.
    Unfortunately the result is the same....still no fading diode.
    Are there any other known issues with the PWM?

    Thanks,
    Matt
     
  4. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Can you try it again with the just released udoobuntu 2 rc2?
     
  5. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Well, you don't have to test. It does not work :(
    The servo sweep example is working though so it seems that the analogwrite does not compile correctly.
    The examples on the web-conf seems to be precompiled binaries that are pushed to the M4
     
  6. Matt557

    Matt557 New Member

    Joined:
    Nov 24, 2015
    Messages:
    6
    Likes Received:
    1
    Hi,
    thx for your help! I did update via apg-get, so I should have the newest release.
    So it seems like PWM on M4 doesn't work at all with the current libraries? Not being able to use the analogWrite command looks like a serious issue to me....
     
  7. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    I already made an issue on github repository. I saw they made a lot of changes on the Arduino environment so 1 of them messed up the PWM I guess. Technically it is working (see the precompiled web example) only the current compiler does something wrong.
     
  8. Matt557

    Matt557 New Member

    Joined:
    Nov 24, 2015
    Messages:
    6
    Likes Received:
    1
    Hi,
    that's really nice. Thank's for your help!
     
  9. ektor5

    ektor5 Administrator Staff Member

    Joined:
    Jul 1, 2013
    Messages:
    97
    Likes Received:
    48
    waltervl likes this.
  10. Matt557

    Matt557 New Member

    Joined:
    Nov 24, 2015
    Messages:
    6
    Likes Received:
    1
    works fine, very nice! :)
     
    waltervl likes this.
  11. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Did you still have to out comment the pinmode of the PWM pin?
     
  12. ektor5

    ektor5 Administrator Staff Member

    Joined:
    Jul 1, 2013
    Messages:
    97
    Likes Received:
    48
    Yes, I'd be better.
    MQX don't support INPUT/OUTPUT definition of PWM pins.

    ek5
     

Share This Page