/*
  https://github.com/Dlloydev/Wokwi-Chip-Analog-Plotter
  by David Lloyd, March 2023.

  Signal Generator by Carlos Arino
  https://wokwi.com/projects/351665576996766295

  This example plots an Analog, LED, PWM and Servo signal.
*/
#include <Servo.h>
Servo myservo;

int servoPin = 10;
int pwmPin = 11;
int ledPin = 13;
int pos = 0;
bool ledState;

void setup() {
  myservo.attach(servoPin);
  pinMode(ledPin, OUTPUT);
  pinMode(pwmPin, OUTPUT);
  analogWrite(pwmPin, 127);
}

void loop() {
  for (pos = 0; pos <= 180; pos += 1) {
    ledState = !ledState;
    digitalWrite(ledPin, ledState);
    myservo.write(pos);
    delay(5);
  }
  for (pos = 180; pos >= 0; pos -= 1) {
    ledState = !ledState;
    digitalWrite(ledPin, ledState);
    myservo.write(pos);
    delay(5);
  }
}
Signal GeneratorBreakout
Loading chip...chip-plotter
Loading chip...chip-plotter
SERVO
Loading chip...chip-plotter
Loading chip...chip-plotter
PWM
LED
ANALOG