You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a simple piece of code that reads a pin and writes the state to a serial port (USB) every 500 milliseconds. If the pin is HIGH then a pwm signal is wrttien to the tonePin with a duty cycle of 128. Either 00 or FF should be written out the port. This works great unless I add the analogWirte function to the code. If I do then that serial data becomes garbage. See code below and then serial output examples below that.
Hi andrewpriddis
I've tried adding the serial print code to our PWM demo, and the serial monitor is outputting the print information correctly. Perhaps you could double-check the rest of your code to see if something is causing the confusion?
Ok, I put the serial monitor into text mode and now I see what all the garbage is.... all the extra text coming over the port. How do I shut that off? I was viewing as Hex expecting to only see 1s and 0s like your example...
I have a simple piece of code that reads a pin and writes the state to a serial port (USB) every 500 milliseconds. If the pin is HIGH then a pwm signal is wrttien to the tonePin with a duty cycle of 128. Either 00 or FF should be written out the port. This works great unless I add the analogWirte function to the code. If I do then that serial data becomes garbage. See code below and then serial output examples below that.
This is the garbage written out the serial port when the button is pushed. It appears that the PWM timer is messing with the serial port.
The text was updated successfully, but these errors were encountered: