# Write to the symbol number (#) to comment, if we want several comment lines we write ''' at the beginnig and at the end
''' This code is on MicroPython, its easier to program but wont detect the errors (it will just not run)
First we declare our constants in this case the led and the button '''
from machine import Pin # Machine is the name of a library while pin is the tool lets us control the physical pins
import time # time is a tool that will let us pause or delay things
ledPin = 16 # ledPin is the variable that defines our led and the number represents the pin it is connected
buttonPin =25 # another varible for the button, in this exercise I changed the pins (to show what other pins can be used)
# Now we configure the pins (similar to setup in C++)
led = Pin(ledPin, Pin.OUT) # Here we define the led as an output (sends)
button = Pin(buttonPin, Pin.IN, Pin.PULL_UP) # Pin. in is an input (reads), pull up is teh internal resistance
while True: # Equivalent to void loop in C++
if button.value() == 0: # If the button is pressed (low)
led.value(1) # the led will turn on (high)
print("Led On") # Prints a message to the serial monitor, same as Serial.print
else: # If the button is not pressed it will happen the contrary
led.value(0)
print("Led Off")
time.sleep(0.4) # Same as delay, but it is now on seconds in C++ is on milliseconds