Hi, I am using an STM32F407G-DISC1 board. I can successfully toggle the I/O pins (set them high and low) using my code, but when I try to print any statements, nothing appears on the serial monitor. I am using a USB type A to Mini-B cable to upload my code. I am using de same baud rate and i am using the correct COM port. Could someone please help me with this?
This my code its a led fading with print staments:
Please post your sketch, using code tags when you do
Posting your code using code tags prevents parts of it being interpreted as HTML coding and makes it easier to copy for examination
In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.
#define LED_PIN PD12 // the PWM pin the LED is attached to
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by
void setup() {
Serial.begin(9600);
pinMode(LED_PIN, OUTPUT);
Serial.println("Setup complete! LED fading begins.");
}
void loop() {
analogWrite(LED_PIN, brightness);
Serial.print("LED Brightness: ");
Serial.println(brightness);
brightness = brightness + fadeAmount;
if (brightness <= 0 || brightness >= 255) {
fadeAmount = -fadeAmount;
}
delay(30);
}