5. Embedded programming¶
Objective
Complete assignments focused on embedded programming, which include both individual and group tasks. This week, I explored the fundamentals of microcontrollers and gained hands-on experience with programming different types of microcontrollers, including the Arduino UNO, using Arduino IDE 2.3.4 and Mu 1.2.0.
Assignments Overview:
-
Group Assessments: Task1: Select a microcontroller and analyze its key parameters.
-
Individual Assessments: Task2: Install Arduino IDE and preform several challengest on a microcontroller. Task3: Install Thonny IDE and preform several challengest on a the KidsIOT microcontroller.
Introduction to Microcontrollers¶
A microcontroller is a compact integrated circuit that combines a processor, memory, and I/O peripherals on a single chip. It is designed to control electronic devices and perform specific tasks, such as managing sensors, motors, and lights. Microcontrollers are commonly used in everyday products like home appliances, cars, and IoT devices, thanks to their low cost, small size, and energy efficiency.
Group Assignment: Task 1 - Select a microcontroller and analyze its key parameters.¶
As part of our group project, we were tasked with researching various microcontrollers to expand our knowledge. Each pair was assigned a specific microcontroller to investigate using datasheets and other resources. Since our Fablab batch had seven members, I worked independently on this task.
For my research, I focused on the Adafruit Feather nRF52840 Sense microcontroller. I examined its key features, including the number of pins, embedded sensors, and supported programming languages, using the official datasheet as my primary reference.
The complete set of findings from our group, including my contributions, has been compiled and can be accessed through the following link.Additionally, my research on the Adafruit Feather nRF52840 Sense is summarized in the table below.
Adafruit Feather nRF52840 Sense Features
Feature | Details |
---|---|
Digital I/O Pins | 20 digital I/O pins (3.3V logic levels). Some pins are dedicated to specific functions. |
Analog Input Pins | 6 analog input pins (A0 to A5), capable of reading voltages from 0V to 3.3V with 12-bit resolution for ADC (analog-to-digital conversion). |
PWM Pins | 8 PWM pins (D3, D5, D6, D9, D10, D11, D12, D13) for generating variable analog-like signals. |
I/O Voltage | 3.3V (Caution: Higher voltages can damage the board. Use level shifters if necessary). |
GND | Multiple GND (ground) pins around the board, marked as G or GND. |
Built-in LED Pin | Built-in LED connected to Pin D13, controllable via software for debugging or signaling. |
Microcontroller | Powered by the Nordic Semiconductor nRF52840 (32-bit ARM Cortex-M4, 64 MHz) with Bluetooth 5.0 BLE, Thread, and Zigbee support. |
Memory | 1MB Flash, 256KB RAM, suitable for complex applications. |
Built-in Sensors |
- BME680: Measures temperature, humidity, pressure, and gas (VOC). - LSM6DSOX: 6-axis IMU (Accelerometer + Gyroscope) for motion tracking. - APDS9960: Gesture, proximity, and ambient light sensor. - Microphone: Built-in for sound detection. |
Wireless Communication | Bluetooth 5.0 Low Energy (BLE), Thread, and Zigbee for wireless communication with low power consumption. |
Compatibility | Compatible with the Arduino IDE (C/C++) and CircuitPython (Python). |
Form Factor | Compact form factor, Feather-compatible, allowing for easy expansion with Feather accessories (e.g., displays, sensors). |
Introduction to Arduino and Embedded Programming¶
Arduino is an open-source platform used to create electronic projects. It includes a microcontroller that can be programmed to interact with sensors, motors, lights, and other devices. The Arduino IDE allows users to write and upload code easily, making it a popular choice for learning about electronics and programming.
Embedded Programming is the practice of writing software for embedded systems—dedicated devices designed for specific functions. Unlike general-purpose computers, embedded systems have limited resources. Embedded programming directly controls hardware to interact with the environment, and is widely used in applications like IoT devices, robotics, and consumer electronics.
Arduino Blink Experiment Documentation¶
Arduino Blink Example¶
In this guide, we will walk through the steps to load, verify, and upload the Blink example to your Arduino board, and modify the blink timing for your first experiment. For more detailed information, you can also visit this site.
Step 1: Download the Arduino IDE¶
Visit the Arduino website to download and install the Arduino IDE on your computer.
Step 2. Open the Arduino IDE and Install the ESP32 Board Package¶
- Go to File > Preferences, and in the “Additional Boards Manager URLs” field, add the following URL:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
- Next, navigate to Tools > Board > Boards Manager…. In the search box, type “esp32”, select the latest version of the ESP32 package, and click Install.
Step 3: Connect the Microcontroller¶
Connect the Arduino board, we used the XIAO_ESP32S3 to the computer using a USB cable.
Step 4: Configure the Arduino IDE¶
- Open the Arduino IDE.
-
Select the correct board:
- Go to
Tools > Board
and select your Arduino model (e.g., XIAO_ESP32S3).
- Go to
-
Select the correct port:
- Navigate to
Tools > Port
and select the port associated with your connected Arduino. Each computer assigns a different name to the port; for example, mine was COM7 (ESP32 Family Device).
- Navigate to
Step 5: Load the Blink Example¶
- Open the Arduino IDE if it’s not already open.
- Navigate to:
File > Examples > 01.Basics > Blink
This will open a basic sketch that blinks the onboard LED of your Arduino.
The code will look like this:
void setup() {
pinMode(LED_BUILTIN, OUTPUT); // Initialize the built-in LED pin as an output.
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED on.
delay(1000); // Wait for 1 second.
digitalWrite(LED_BUILTIN, LOW); // Turn the LED off.
delay(1000); // Wait for 1 second.
}
Step 6: Verify and Upload the Code¶
Verify the Code 1. In the Arduino IDE, click the checkmark icon (✓) located in the top-left corner. - This will verify the code for any syntax or compilation errors. 2. If there are any errors in the code, they will be displayed in the output window at the bottom of the IDE. - Review and fix the errors before proceeding to upload.
Upload the Code 1. Once the code is verified with no errors, click the right arrow icon (→) next to the checkmark. - This will compile the code and upload it to your Arduino board.
Success - After the upload is complete, the onboard LED on the Arduino will start blinking according to the timing specified in the code. - By default, the LED will turn ON for 1 second and OFF for 1 second. - If you’ve modified the code to change the timing, the LED will reflect your changes (e.g., ON for 2 seconds, OFF for 0.5 seconds).
Task: Modifying the LED Blink Timing¶
In this experiment, the goal was to modify the timing of the onboard LED’s blink pattern.
Specifically, we made the following adjustments: - The ON duration of the LED was changed from 1 second (1000 ms) to 2 seconds (2000 ms). - The OFF duration of the LED was changed from 1 second (1000 ms) to 0.5 seconds (500 ms).
Original Code
void setup() {
pinMode(LED_BUILTIN, OUTPUT); // Initialize the LED pin as an output.
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED on (HIGH is the voltage level).
delay(1000); // Wait for 1 second.
digitalWrite(LED_BUILTIN, LOW); // Turn the LED off (LOW is the voltage level).
delay(1000); // Wait for 1 second.
}
Adjusted Code
void setup() {
pinMode(LED_BUILTIN, OUTPUT); // Initialize the LED pin as an output.
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED on (HIGH is the voltage level).
delay(2000); // Wait for 2 seconds.
digitalWrite(LED_BUILTIN, LOW); // Turn the LED off (LOW is the voltage level).
delay(500); // Wait for 0.5 seconds.
}
Code Output
-
LED blinking for 1 second ON and 1 seconds OFF.
-
LED blinking for 0.5 seconds ON and 0.5 seconds OFF.
Task 2: Individual Assignment: Programming Challanges¶
Once we got the hang of the Arduino IDE software, we were given three coding challenges to tackle on our own. The PDF document we received laid out the challenges, with increasing levels of difficulty: easy, medium, and hard.
Challenge 1: Easy Mode: Randomize Blink Delay¶
Challange: Blink your led but have your blink delay periods be randomized values between 1 second and 5 seconds.
Key Concept:
You just need to add random(1000, 5001)
to create the random delay time.
As adding random(1000, 5001)
within the delay()
function is the key to achieving the random blink delay.
Why random(1000, 5001)
?
The random()
function in Arduino generates a value from the minimum (inclusive) to the maximum (exclusive).
random(1000, 5000)
generates values between 1000 and 4999 (excluding 5000).random(1000, 5001)
includes 5000, ensuring the delay can be up to 5000 milliseconds (5 seconds).
Thus, to include 5 seconds, we use random(1000, 5001)
.
Code
// Random Blink
//Turns the LED on for a random duration between 1 and 5 seconds, then off for a random duration between 1 and 5 seconds.
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(random (1000,5001); // LED on for a random duration between 1 and 5 seconds
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(random (1000,5001); // LED off for a random duration between 1 and 5 seconds
}
Code Output (2x Speed)
Challenge 2: Medium Mode: Morse Code Message¶
Challange: pre code your microcontroller to send a Morse code 1 word message and challenge a friend, family member, your colleagues or your instructor to figure it out.
the word that i have choosen to code is “HELP” and based on the PDF given data below the letters coding should be as follows Help (H=.... , E=. , L=.-.. , P=.–.)
PDF DATA
Code generated is as follows,
code
//#Word to be coded= Help (H=.... , E=. , L=.-.. , P=.--.)
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
// Morse Code for "H" = "...."
// Dot (1 second on)
digitalWrite(LED_BUILTIN, HIGH); // turn the LED off
delay(5000); // startup
digitalWrite(LED_BUILTIN, LOW); // turn the LED on
delay(1000);
// Dot (1 second on)
digitalWrite(LED_BUILTIN, HIGH); // turn the LED off
delay(500); // wait for 0.5 second gap between dots
digitalWrite(LED_BUILTIN, LOW); // turn the LED on
delay(1000); // wait for 1 second
// Dot (1 second on)
digitalWrite(LED_BUILTIN, HIGH); // turn the LED off
delay(500); // wait for 0.5 second gap between dots
digitalWrite(LED_BUILTIN, LOW); // turn the LED on
delay(1000); // wait for 1 second
// Dot (1 second on)
digitalWrite(LED_BUILTIN, HIGH); // turn the LED off
delay(500); // wait for 0.5 second gap between dots
digitalWrite(LED_BUILTIN, LOW); // turn the LED on
delay(1000); // wait for 1 second
// Morse Code for "E" = "."
// Dot (1 second on)
digitalWrite(LED_BUILTIN, HIGH); // turn the LED off
delay(3000); // 3 seconds gap between letters
digitalWrite(LED_BUILTIN, LOW); // turn the LED on
delay(1000); // wait for 1 second
// Morse Code for "L" = ".-.."
// Dot (1 second on)
digitalWrite(LED_BUILTIN, HIGH); // turn the LED off
delay(3000); // 3 seconds gap between letters
digitalWrite(LED_BUILTIN, LOW); // turn the LED on
delay(1000); // wait for 1 second
// Dash (2 seconds on)
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on
delay(500); // // 0.5 second gap
digitalWrite(LED_BUILTIN, LOW); // turn the LED off
delay(2000); // wait for 2 second
// Dot (1 second on)
digitalWrite(LED_BUILTIN, HIGH); // turn the LED off
delay(500); // 0.5 second gap
digitalWrite(LED_BUILTIN, LOW); // turn the LED on
delay(1000); // wait for 1 second
// Dot (1 second on)
digitalWrite(LED_BUILTIN, HIGH); // turn the LED off
delay(500); // 0.5 second gap
digitalWrite(LED_BUILTIN, LOW); // turn the LED on
delay(1000); // wait for 1 second
// Morse Code for "P" = ".--."
// Dot (1 second on)
digitalWrite(LED_BUILTIN, HIGH); // turn the LED off
delay(3000); // 3 seconds gap between letters
digitalWrite(LED_BUILTIN, LOW); // turn the LED on
delay(1000); // wait for 1 second
// Dash (2 seconds on)
digitalWrite(LED_BUILTIN, HIGH); // turn the LED off
delay(500); // 0.5 second gap
digitalWrite(LED_BUILTIN, LOW); // turn the LED on
delay(2000); // wait for 2 second
// Dash (2 seconds on)
digitalWrite(LED_BUILTIN, HIGH); // turn the LED off
delay(500); // 0.5 second gap
digitalWrite(LED_BUILTIN, LOW); // turn the LED on
delay(2000); // wait for 2 second
// Dot (1 second on)
digitalWrite(LED_BUILTIN, HIGH); // turn the LED off
delay(500); // 0.5 second gap
digitalWrite(LED_BUILTIN, LOW); // turn the LED on
delay(1000); // wait for 1 second
}
Code Output (2x Speed)
Challenge 3: Hard Mode: Serial Monitor Blink Control¶
Challange: you select the duration of the light being on and off while the program is running by entering it in the serial monitor. Write a code that takes the data from the serial monitor and delays by that amount of time.
Key Concept Program the microcontroller to accept input from the serial monitor to control the duration of LED on and off periods. AS this challenge introduces real-time interaction with the microcontroller, where users can input commands to control the LED blink duration.
Variable Declaration
const int ledPin = 13;
const int ledPin = 13;
: This line declares a constant integer variable named ledPin and assigns it the value 13. This pin number corresponds to the built-in LED on most Arduino boards. Theconst
keyword ensures that the value ofledPin
cannot be changed during the program’s execution.
Pin Mode Setup
pinMode(ledPin, OUTPUT);
pinMode(ledPin, OUTPUT);
: This line sets theledPin
as an output pin. This means that the Arduino can control the voltage level on this pin, effectively turning the LED on or off.
Serial Communication Initialization
Serial.begin(9600);
Serial.begin(9600);
: This line initializes serial communication at a baud rate of 9600 bits per second. Serial communication allows the Arduino to receive data from a computer or other devices. Checking for Serial Input
if (Serial.available() > 0)
if (Serial.available() > 0)
: This condition checks if there is any data available to be read from the serial buffer. If there is, the code proceeds to the next steps.
Reading Input Values
int onTime = Serial.parseInt();
int offTime = Serial.parseInt();
int onTime = Serial.parseInt();: This line reads the first integer value from the serial buffer and stores it in the
onTime` variable.int offTime = Serial.parseInt();
: This line reads the second integer value from the serial buffer and stores it in theoffTime
variable. These values will determine the duration of the LED’s on and off states.
Controlling the LED
digitalWrite(ledPin, HIGH);
delay(onTime);
digitalWrite(ledPin, LOW);
delay(offTime);
digitalWrite(ledPin, HIGH);
: This line sets the voltage level on theledPin
to HIGH, turning the LED on.delay(onTime);
: This line pauses the program execution for the specifiedonTime
in milliseconds, keeping the LED on for that duration.digitalWrite(ledPin, LOW);
: This line sets the voltage level on theledPin
to LOW, turning the LED off.delay(offTime);
: This line pauses the program execution for the specifiedoffTime
in milliseconds, keeping the LED off for that duration.
Continuous Loop
The code is enclosed within a loop()
function, which continuously checks for new serial input and adjusts the LED’s blinking pattern accordingly. This creates a dynamic and interactive behavior for the LED.
Code
//Hard mode: you select the duration of the light being on and off while the program is running by entering it in the serial monitor.
//Write a code that takes the data from the serial monitor and delays by that amount of time.
const int ledPin = 13;
void setup() {
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
if (Serial.available() > 0) {
int onTime = Serial.parseInt();
int offTime = Serial.parseInt();
digitalWrite(ledPin, HIGH); // Turn the LED ON
delay(onTime);
digitalWrite(ledPin, LOW); // Turn the LED OFF
delay(offTime);
}
}
Code Output
Setting Up Thonny¶
Step1: Install Thonny IDE:¶
Download and install Thonny IDE from the official Thonny website.
Step2: Connect the Microcontroller to Thonny IDE:¶
-
Connect your microcontroller (e.g., KidsIOT ESP32) to your laptop using a USB wire.
-
Press the reset button on the microcontroller.
-
In Thonny, go to
View > Files
to open the file explorer. Ifboot.py
appears on the left side, the connection is successful. If not, press the reset button again.
Step3: Connect External LED:¶
- since the kidsIOT does not have a built in LED, Connect an external LED to a cable, then connect the other side to the microcontroller’s port (e.g., IO26).
Step4: Configure Thonny for MicroPython:¶
after opening the *Thonny Software
- Go to Run > Configure Interpreter
.
- In the Interpreter
tab, select MicroPython (ESP32)
from the dropdown.
- Choose the correct port (e.g., USB Serial @ COM11
).
- Click
Install or Update MicroPython (esptool)(UF2)
to ensure you have the latest firmware.
After that a pop up menu will appear, fill it with the following:
- Choose the correct port (e.g.,
USB Serial @ COM11
). - In the
MicroPython family
, select (ESP32
) from the dropdown. In the variant, select (Espressif • ESP32 / WROOM
) from the dropdown. ClickInstall
, then clickOk
after installing.
Step5: Write and Run your code:¶
- Create a New Document , write the code and save it by clicking the save icon and selecting eaither save to
this computer
orMicropython device
- Next, Click the green ‘Run’ icon to send the code to the microcontroller.
- once done you can stop or restart the ode by pressing the stop red icon.
### Thonny Experiment: Blinking LED in a Loop
Code
import machine
import time
led = machine.Pin(26, machine.Pin.OUT)
while True:
led.value(1) # Turning the LED on
time.sleep(1) #LED stays on for 1 second
led.value(0) # Turning the LED off
time.sleep(1) #LED stays off for 1 second
Code Output
Thonny Experiment2 : Adjusting Blinking Time¶
In this experiment, the goal was to modify the timing of the onboard LED’s blink pattern.
Specifically, I made the following adjustments: - The time.sleep of both ON and Off duration of the LED was changed from 1 second to 0.5 second.
Code
import machine
import time
led = machine.Pin(26, machine.Pin.OUT)
while True:
led.value(1) # Turning the LED on
time.sleep(0.5) #LED stays on for 0.5 second
led.value(0) # Turning the LED off
time.sleep(0.5) #LED stays off for 0.5 second
Code Output
Task 3: Individual Assignment: Programming Challanges¶
After completing the foundational experiment, we transitioned to replicating the PDF three challenges done previously with the Arduino IDE, this time utilizing the KidsIOT microcontroller and the Thonny IDE development environment.
Challenge 1: Easy Mode: Randomize Blink Delay¶
Challange: Blink your led but have your blink delay periods be randomized values between 1 second and 5 seconds.
Key Concept:
This challenge helps understand the use of the random
library in MicroPython and how to generate random delay intervals. making the pattern dynamic and less predictable.
Code
import machine
import time
import random # Call out the Random library
led = machine.Pin(26, machine.Pin.OUT)
while True:
led.value(1) # Turning the LED on
time.sleep(random.randrange(1,5)) #LED stays on for a random value between 1 to 5 seconds
led.value(0) # Turning the LED off
time.sleep(random.randrange(1,5)) #LED stays off for a random value between 1 to 5 seconds
Code Output
Challenge 2: Medium Mode: Morse Code Message¶
Challange: pre code your microcontroller to send a Morse code 1 word message and challenge a friend, family member, your colleagues or your instructor to figure it out.
Key Concept: This challenge introduces the concept of encoding messages in Morse code and using timed LED blinks to represent the dots and dashes.
the word that i have choosen to code is “HELP” and based on the PDF given data below the letters coding should be as follows Help (H=.... , E=. , L=.-.. , P=.–.)
PDF DATA
Code generated is as follows,
code
import machine
import time
led = machine.Pin(26, machine.Pin.OUT) #initialize digital pin 26 as an output
#Morse Code Data
#dot 1 second light on
#dash 2 second light on
#gap between dots and dashes 0.5 second light off
#gap between letters 3 second light off
#Gap at the end of a full word 5 second ligh
#Word to be coded= Help (H=.... , E=. , L=.-.. , P=.--.)
while True:
#Morse Code for "H" = "...."
#Dot (1 second on)
led.value(1) #Turning the LED on
time.sleep(1) #LED on for 1second (dot)
led.value(0) #Turning the LED on
time.sleep(0.5) #LED off for 0.5second (gap)
#Dot (1 second on)
led.value(1) #Turning the LED on
time.sleep(1) #LED on for 1second (dot)
led.value(0) #Turning the LED on
time.sleep(0.5) #LED off for 0.5second (gap)
#Dot (1 second on)
led.value(1) #Turning the LED on
time.sleep(1) #LED on for 1second (dot)
led.value(0) #Turning the LED on
time.sleep(0.5) #LED off for 0.5second (gap)
#Dot (1 second on)
led.value(1) #Turning the LED on
time.sleep(1) #LED on for 1second (dot)
led.value(0) #Turning the LED on
time.sleep(3) #LED off for 3seconds (gap between letters)
#Morse Code for "E" = "."
#Dot (1 second on)
led.value(1) #Turning the LED on
time.sleep(1) #LED on for 1second (dot)
led.value(0) #Turning the LED on
time.sleep(3) #LED off for 3seconds (gap between letters)
#Morse Code for "L" = ".-.."
#Dot (1 second on)
led.value(1) #Turning the LED on
time.sleep(1) #LED on for 1second (dot)
led.value(0) #Turning the LED on
time.sleep(0.5) #LED off for 0.5second (gap)
#Dash (2 second on)
led.value(1) #Turning the LED on
time.sleep(2) #LED on for 2second (dash)
led.value(0) #Turning the LED on
time.sleep(0.5) #LED off for 0.5second (gap)
#Dot (1 second on)
led.value(1) #Turning the LED on
time.sleep(1) #LED on for 1second (dot)
led.value(0) #Turning the LED on
time.sleep(0.5) #LED off for 0.5second (gap)
#Dot (1 second on)
led.value(1) #Turning the LED on
time.sleep(1) #LED on for 1second (dot)
led.value(0) #Turning the LED on
time.sleep(3) #LED off for 3seconds (gap between letters)
#Morse Code for "P" = ".--."
#Dot (1 second on)
led.value(1) #Turning the LED on
time.sleep(1) #LED on for 1second (dot)
led.value(0) #Turning the LED on
time.sleep(0.5) #LED off for 0.5second (gap)
#Dash (2 second on)
led.value(1) #Turning the LED on
time.sleep(2) #LED on for 2second (dash)
led.value(0) #Turning the LED on
time.sleep(0.5) #LED off for 0.5second (gap)
#Dash (2 second on)
led.value(1) #Turning the LED on
time.sleep(2) #LED on for 2second (dash)
led.value(0) #Turning the LED on
time.sleep(0.5) #LED off for 0.5second (gap)
#Dot (1 second on)
led.value(1) #Turning the LED on
time.sleep(1) #LED on for 1second (dot)
led.value(0) #Turning the LED on
time.sleep(5) #LED off for 5 seconds (gap at the end of a word)
Code Output
Challenge 3: Hard Mode: Serial Monitor Blink Control¶
Challange: you select the duration of the light being on and off while the program is running by entering it in the serial monitor. Write a code that takes the data from the serial monitor and delays by that amount of time.
Key Concept Program the microcontroller to accept input from the serial monitor to control the duration of LED on and off periods. AS this challenge introduces real-time interaction with the microcontroller, where users can input commands to control the LED blink duration.
from machine import Pin
import time
# Initialize the LED pin
LED = Pin(26, Pin.OUT)
while True:
# Get user input for on and off durations
try:
LEDON = float(input("Enter the On time in seconds: "))
LEDOFF = float(input("Enter the Off time in seconds: "))
except ValueError:
print("Invalid input. Please enter numeric values.")
continue # Skip to the next iteration if input is invalid
# Blink the LED based on the input durations
for x in range(6):
LED.value(1) # Turn the LED on
time.sleep(LEDON) # Wait for the specified on duration
LED.value(0) # Turn the LED off
time.sleep(LEDOFF) # Wait for the specified off duration
print("Cycle complete. You can enter new values.")
Code Output
1. Serial Moniter value of 0.5 second both ON and Off after completing the cycle of 6 repetitions you can enter a diffrent value.
- Serial Moniter value of 1 second both ON and Off after completing the cycle of 6 repetitions you can enter a diffrent value.