Challenge

Project 1 - Controlling a DC motor using PWM and monitoring its Running status

#include
#define F_CPU 16000000UL
#include

char seven_seg[10] = {0X3F, 0X06, 0X5B, 0X4F, 0X66, 0X6D, 0X7D, 0X07, 0X7F, 0X6F}; //setting the 7 segment display values in an array
int main(void)
{
    DDRC=0xFF; //making port C as output
    DDRB=0xFF; //making port B as output
    int i=0;
    int j=0;
    while (1)
    {
        PORTC=seven_seg[i];
        PORTB=seven_seg[i];
        for(int i=0;i<10;i++)
        {
            PORTC=seven_seg[i]; //displaying in port C
            for(j=0;j<10;j++) //loop to display the values till 9 keeping the other value constant in an iteration
            {
                PORTB=seven_seg[j]; //displaying in port B
                _delay_ms(1000); //delay of 1000ms
            }

        }
    }
}

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.