Education

Education

Education

Robo Explorers 1

Robo Explorers 1

Beginners guide to Robotics

UV LED

Robo Explorers

What is a UV LED

The UV LED or the Ultraviolet LED works the same as a regular LED but it produces UV light when some power is provided to the component. Let’s understand how an LED is able to produce specific color and in this case UV color light.



Let’s have a look at the code for the UV LED and understand it’s setup.

#include <avr/io.h>  //gpio setup
#include <avr/interrupt.h> //for interupt service routines
#include <util/delay.h> // here the delay function is found
#include <stdio.h> // for printf and stuff
#include "usart.h" // serial communication

int main(void){
    int state = 0;
    DDRD = 0xFF; // FOR LED
    DDRC = 0xF0; // FOR BUTTON
    DDRB = 0xFF;
    PORTD = 0x00;
    PORTB = 0x00;
    PORTC = 0x3F;
    while (1){
        PORTD = 0b11111000;
        if(PINC==0b00111111){
            PORTB = 0b00000000;
        }
        if(PINC==0b00111101){
            
            PORTB = 0b00000001;
        }
        if (state == 0){
            if(PINC==0b00111110){
                PORTB = 0b00000010;
                _delay_ms(2000);
                state = 1;
            }
        }
        if (state == 1){
            if(PINC==0b00111110){
                PORTB = 0b00000100;
                _delay_ms(2000);
                state = 0;
            }
        }
    }
}

The code can be divided into many parts or blocks as per the usage and components on the board. Let’s say we have 5 LEDs, 1 buzzer, 1 motor and few switches to control on our Yellow Tyro Board.

Now you would wonder, what about the potentiometer?

It is more of an electronic component than a programmable in our use case and we will learn more about it in the specific section.



Learn from a Professional

Book a Class

Socials

info.jumplabs@gmail.com

Call Us

+4550142069

+919560372931

Damgade 82, 6400 Sønderborg

© Jumplabs Inc. 2023

Reach out to Us

Socials

info.jumplabs@gmail.com

Call Us

+4550142069

+919560372931

Damgade 82, 6400 Sønderborg

© Jumplabs Inc. 2023

Reach out to Us