Education

Education

Education

Robo Explorers 1

Robo Explorers 1

Beginners guide to Robotics

Arduino

Robo Explorers

What is an Arduino

Arduino is the brain of our PCB and is already pre-programmed. Your first task in the book is to activate the Arduino! Here is a video on how we can activate the Arduino.

Now that you have fulfilled your task let’s learn something out of the box!

Below you would see the code which has been implemented in  our Arduino.

#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