# Example 1: Your First Micropython Program
print("Hello., Micropython!")
# Comments:
# - Micropython uses the familiar Python syntax, making it easy to write and understand code.
# - The "print()" function is used to display text, just like in regular Python.
# Example 2: LED Blinking
# Basic LED blinking program using Micropython.
import machine
import time
led = machine.Pin(4, machine.Pin.OUT) # GPIO Pin 2 as an output
while True:
led.on() # Turn on the LED
time.sleep(1) # Wait for 1 second
led.off() # Turn off the LED
time.sleep(1) # Wait for 1 second
# Comments:
# - We're using the "machine" module to interact with the hardware.
# - Pin 2 is configured as an output to control an LED.
# - The LED is turned on and off with a delay of 1 second using the "time.sleep()" function.