Steps to Create a Timing LED Project
1
Open OmniBoard Studio and create a new project.
2
Drag and drop the necessary blocks to create a simple circuit that turns an LED on and off with different timing intervals.
Try to explore and make the diagram yourself or click here to find out one of the solutions. ▼
- ●Place Start block.
- ●Connect the Start block to a While True block. This will create an infinite loop that allows the LED to keep blinking.
- ●Connect the ¨While True block to a Timer block. Set the timer duration to your desired interval (e.g., 1000 milliseconds for 1 second).
- ●Connect the Timer block to a LED ON block. The timer will control the time it will take for the LED to turn ON
- ●Then connect the LED ON block to another timer. Here you can also set the duration to whatever you want
- ●Connect the second Timer block to a LED OFF block. This will control how long the LED stays ON before it turns OFF.
3
Make the correct circuit
Try to make the circuit from memory becouse it's the same as the circuit for blinking LED or click here to see the solutuon ▼
- ●Connect the GPIO pin asigned to the LED to the rezistor.
- ●Connect the positive leg of the LED to a resistor, and then connect the other end of the LED to ground. You can determine which leg is positive and which is negative by finding the longer leg (positive) and shorter leg (negative) or flat side of the LED cover (negative).
4
Compile the code and upload it to your microcontroller.
5
Watch your LED blink on and off at the interval you set with the Timer block!
Bonus informations
- Here is an example of simplified the MicroPython code that would be generated by the blocks for a button controlled LED project:
from machine import Pin # Import the Pin class to control GPIO pins
import time # Import the time module for timing functions
led = Pin(15, Pin.OUT) # Set GPIO pin 15 as an output for the LED
while True: # Start an infinite loop
led.value(1) # Turn the LED on
time.sleep(1) # Wait for 1 second
led.value(0) # Turn the LED off
time.sleep(1) # Wait for 1 second
import RPi.GPIO as GPIO # Import the RPi.GPIO library to control GPIO pins
import time # Import the time module for timing functions
GPIO.setmode(GPIO.BCM) # Set the GPIO mode to BCM
GPIO.setup(15, GPIO.OUT) # Set GPIO pin 15 as an output for the LED
while True: # Start an infinite loop
GPIO.output(15, GPIO.HIGH) # Turn the LED on
time.sleep(1) # Wait for 1 second
GPIO.output(15, GPIO.LOW) # Turn the LED off
time.sleep(1) # Wait for 1 second