Skip to content

Slow down of loop when servo used #34

@pelikhan

Description

@pelikhan

Running this program on CPX + SG92R on pin A1,

  • on battery, it grinds to a locks within seconds.
  • on USB, it slows down to a grind after a minute
#include "CircuitPlayground.h"

CircuitPlayground cplay;

int main()
{
    int status = 0;
    while(1)
    {
        cplay.io.led.setDigitalValue(status);
        cplay.io.a1.setServoValue(30 + rand() % 15);
        cplay.sleep(20);
        status = !status;
    }
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions