This report reviews the design of a simple embedded project for beginners, titled "Blink20250520.ino". The project aims to blink an LED connected to an Arduino UNO R3 board.
The Arduino code is structured into two main functions, setup() and loop(), which is typical for Arduino programs. It also defines two structures, CodeInfo and Led, to organize project information and LED parameters.
/*
make design review report for Embedded beginners on html file format
Blink20250520.ino
Description: An LED is blinking on board
board: Ar5duino UNO3 atmega328P 16MHz
langiuage : C/C++
IDE: Arduino IDE 2.3.6 on windows11
tools >> board :Arduino UNO3
tools >> Port "COM6": COM6 (arduino UNO)
*/
struct CodeInfo{
const String board;
const String codeId;
};
struct Led{
const byte port;
const String name;
byte status;
const int onTime;
const int offTime;
};
struct CodeInfo ci={"uno3","U3AS104"};
struct Led l13={13,"led13",0,1000,1000};
void setup() {
pinMode(l13.port, OUTPUT);
Serial.begin(115200);
}
void loop() {
Serial.print("{\"board\":\""+ci.board+"\"");
Serial.println("\"codeId\":\""+ci.codeId+"\"}");;
digitalWrite(l13.port,HIGH); // turn the LED on (HIGH is the voltage level)
l13.status=digitalRead(LED_BUILTIN);
Serial.print("{\""+ l13.name +"\":");
Serial.print(l13.status);
Serial.println("}");
delay(l13.onTime);
digitalWrite(l13.port, LOW); // turn the LED off by making the voltage LOW
Serial.print("{\""+ l13.name +"\":");
l13.status=digitalRead(LED_BUILTIN);
Serial.print(l13.status);
Serial.println("}");
delay(l13.offTime);
}
board, codeId, port, name, onTime, and offTime are descriptive and easy to understand.struct to group related data (CodeInfo and Led) improves code organization and readability.pinMode() to set the LED pin as an output, digitalWrite() to control the LED state, delay() to introduce pauses, and Serial.begin()/Serial.print()/Serial.println() for serial communication.Serial.print() statements to output information about the board, code ID, and LED status. This is good practice for debugging and monitoring.loop() function repeatedly turns the LED on for 1000 milliseconds and then off for 1000 milliseconds, creating a one-second blink interval.LED_BUILTIN using digitalRead() and prints it. For the built-in LED controlled by digitalWrite(13, ...), LED_BUILTIN typically refers to pin 13, so the read status will reflect the set status.The use of structures helps to keep related information together, making the code easier to read and manage, especially as projects become more complex.
The comments in the code explain the purpose of different sections and specific lines, which is very helpful for beginners to understand what the code is doing.
Printing the board information, code ID, and LED status to the serial monitor is excellent for debugging and understanding the program's behavior. Beginners can use the serial monitor in the Arduino IDE to see these outputs.
While board, codeId, port, name, onTime, and offTime are correctly declared as const (meaning their values should not change after initialization), the status variable in the Led structure is not. Since the status changes, it should not be const. This is correctly implemented in the code.
For beginners, it's important to understand that LED_BUILTIN is a predefined constant in the Arduino environment that usually corresponds to the pin connected to the on-board LED (typically pin 13 on the UNO). The code correctly uses this for reading the status, although the status being read is directly set by the digitalWrite command on the same pin.
Beginners could experiment with changing the onTime and offTime values to observe different blinking speeds. This helps in understanding the effect of the delay() function.
As a next step, beginners could try controlling multiple LEDs connected to different digital pins. This would involve creating more Led structure instances and controlling their pins in the loop() function.
The provided serial output shows the program is functioning as expected:
13:54:25.989 -> {"board":"uno3","codeId":"U3AS104"}
13:54:25.989 -> {"led13":1}
13:54:26.990 -> {"led13":0}
The output indicates that the board information and code ID are correctly printed. Subsequently, the LED status is printed as 1 (HIGH, LED on) and then 0 (LOW, LED off), confirming the blinking behavior with approximately a one-second interval for each state.
This simple blinking LED project is a good starting point for embedded beginners. The code is well-structured and includes helpful comments and serial output for debugging. The suggestions provided aim to guide beginners in further exploration and learning about embedded systems and Arduino programming.
Digital pins on the Arduino can be either inputs or outputs. In this project, pin 13 is configured as an output to control the LED. When you set a digital pin to HIGH, it outputs a voltage (usually 5V), and when you set it to LOW, it outputs 0V. The LED lights up when it receives enough voltage and turns off when the voltage is removed.