suria sarath
Published © TAPR-OHL

music light

music light project gives two different color lights blink when play music without music system connection.

IntermediateWork in progress246
music light

Things used in this project

Software apps and online services

Microchip Studio
Microchip Studio

Story

Read more

Code

music lights led code

C/C++
PA1 audio input, port c output
/*
 * music lights.c
 *
 * Created: 09-07-2015 16:19:04
 *  Author: SURIA SARATH
 */ 


#include <avr/io.h>
#include <util/delay.h>

 int blink_blue(void)
{
	DDRC = 0xff;
   
    PORTC = 0x20;
		
	return 0;
}
 int blink_red(void)
 {
	 DDRC = 0xff;
	 PORTC = 0x10;
	 
	     return 0;
 }
int main()
{
DDRA=0x00;
while(1)
{
	if (PINA & (1<<PA0)==1)
	{
		blink_red();
		_delay_ms(200);
}
if (PINA | (1<<PA0)==1)
{
	blink_blue();
	_delay_ms(3);
}
}
}

Credits

suria sarath
8 projects • 26 followers
Embedded software programmer at Lanware Solutions

Comments