Avatar for Frank

Frank

Member since Aug 2017 • Last active Sep 2017
  • 1 conversations
  • 11 comments

Most recent activity

  • Avatar for Frank

    I'm glad that you have solved the mystery.

    I hope that I was of some assistance, although all I really did was complain :-)

  • Avatar for Frank

    In my case the problem isn't the WiFi code.

    I spent some time adding comments to my code until I isolated the lines that triggered the problem;

    Line 3 was the culprit (I included the rest of the SPI configuration commands in case they are relevant)

    var spi = new SPI();
    spi.setup({mosi: B6 /* D1 */, sck:B5 /* D0 */});
    oled = require("SH1106").connectSPI(spi, B8 /* DC */, B7 /* RST - can leave as undefined */, screenReady);
    
  • Avatar for Frank

    My apologies, it turns out that I was mistaken.

    After doing a reset()/save() and then a power cycle, pin A0 works perfectly with this command;
    analogWrite(A0,0.5, {freq:1});

    When I stated that a power cycle didn't help I was referring to all previous cases, where I had done a reset(), but not a save(), before cycling the power.

    Interestingly I am running wifi code as well, so it could very possible be related to the wifi system.

    Regards
    Frank

  • Avatar for Frank

    1) process.version
    ="1v93"

    2)dump()
    =undefined
    (I previously did a reset()/save())

    3) analogWrite(A0,0.5, {freq:1,forceSoft:true});
    This works perfectly

    4) A full power cycle doesn't make a difference.

    Thanks for the offer, but a replacement isn't necessary. I was just worried that I was doing something wrong. I will just switch to using other ports, or use the 'forceSoft' option where necessary.

    Thanks for your time and effort in helping me to resolve the issue.

    Regards
    Frank

  • Avatar for Frank

    Hi Gordon

    In order to keep my project moving I am just going to switch to using ports A7 and B1, those two ports are fine. It is just A0 that is acting flaky, but if you need me to keep testing various scenarios I will do so.

    Regards
    Frank

  • Avatar for Frank

    1) reset()

    2) analogWrite(A0,0.5, {freq:1});
    LED flashes on for half a second and then off for half a second and then remains on.

    3) analogWrite(A0,0.1, {freq:1});
    LED stays on

    4) analogWrite(A0,0, {freq:1});
    LED switches off

    5) >getPinMode(A0)
    ="af_output"

    6) digitalWrite(A0, 1);
    LED turns on.

    7) digitalWrite(A0, 0);
    LED turns off.

    8) getPinMode(A0)
    ="output"

    6) analogWrite(A7,0.5, {freq:1});
    LED flashes on and off for half a second and continues to flash as expected.

    7) getPinMode(A7)
    ="af_output"

  • Avatar for Frank

    I might have answered my own question.

    I have a setwatch enabled on 'BTN', and according to the setwatch documentation it appears that pin A0 may be affected by the setwatch command?

    Is that maybe the reason for my A0 PWM problem?

    Update: it seems that the setwatch command is not the cause of my problem. Even after removing the code there was no improvement in the PWM behaviour of pin A0

  • Avatar for Frank

    Okay, time for some feedback.

    After spending 2 days experimenting with various hardware configurations and code implementations, and questioning my sanity, I have discovered that using pin A0 does not give me any discernible PWM output variation on my LED, but when I eventually gave up on pin A0 and switched to using pin A7 everything started working as expected.

    Since I don't have an oscilloscope (yet) I am unable to do any additional diagnostics, all I can say is that, with exactly the same code, the A0 pin either turns the LED or motor fully on or fully off, yet pin A7 give me the expected PWM variation.

    For example, if I use the following code and ramp the value of the 'speed' variable from 0.1 to 0.9 over a few seconds then the LED turns fully on or off at 0.1.
    analogWrite(A0,speed, {freq:500});

    But if I use the same code on pin A7 then the LED and motor ramp up exactly as expected.
    analogWrite(A7,speed, {freq:500});

Actions