0

I want to plot the PWM emitted by pin 9 and read by pin 0 in a static PWM signal (like an oscilloscope can do). Is there a simple way to do that?

int pwm = 254;
float pulse1;

void setup() {
  pinMode(9, OUTPUT);
  pinMode(0, INPUT);
  Serial.begin(115200);
}

void loop() {
  analogWrite(9, pwm);
  pulse1 = pulseIn(0, pwm);

  Serial.println(analogRead(0));
//  Serial.println(pulse1);  
}

I am using an Arduino Uno.

Artur Müller Romanov
  • 4,417
  • 10
  • 73
  • 132

1 Answers1

2

I assume you want to graph the data you receive through the serial monitor. If it is so, you can print a comma after each value -> save the output of the serial monitor to a file with CSV extension -> open the file with MS Excel (or similar)