Education

Education

Education

Robo Explorers 1

Robo Explorers 1

Beginners guide to Robotics

Buzzer

Robo Explorers

What is a Buzzer

Let’s proceed with the 3rd task according to the book! Here we need to activate the buzzer and make all the bats and bugs scare away from the team.


Check out this video for a detailed guide to activate the buzzer.


Let’s have a look at how the buzzer is setup in the main code.

#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;
            }
        }
    }
}

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