Education

Education

Education

Robo Explorers 1

Robo Explorers 1

Beginners guide to Robotics

Yellow LED

Robo Explorers

What are LEDs (Light Emitting Diodes)

LEDs are small bulbs which have two terminals. One is called the positive anode and the other is the negative cathode. These small light emitting diodes (LEDs) produce light with only 1.5 to 3.6 volts. 


Let’s look at how the Yellow LED is connected on our Yellow Tyro Board.

Connecting LEDs to Tyro Board

#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