/*
https://github.com/Dlloydev/Wokwi-Chip-Scope
by David Lloyd, March 2023.
This 4 channel scope chip allows you to graph four analog or digital
signals as they vary over time.
*/
#include <Servo.h>
Servo myservo;
int servoPin = 10;
int pwmPin = 11;
int nledPin = 12;
int ledPin = 13;
int pos = 0;
bool ledState;
void setup() {
myservo.attach(servoPin);
pinMode(ledPin, OUTPUT);
pinMode(nledPin, OUTPUT);
pinMode(pwmPin, OUTPUT);
analogWrite(pwmPin, 63);
}
void loop() {
for (pos = 0; pos <= 180; pos += 1) {
ledState = !ledState;
digitalWrite(ledPin, ledState);
digitalWrite(nledPin, !ledState);
myservo.write(pos);
delay(5);
}
for (pos = 180; pos >= 0; pos -= 1) {
ledState = !ledState;
digitalWrite(ledPin, ledState);
digitalWrite(nledPin, !ledState);
myservo.write(pos);
delay(5);
}
}