Hi im working on a project for school and i have got stuck. I am making a burglar alarm which is meant to make the lights at different speeds depending if the zone is armed, or triggerd. what i am trying to do atm is get my lgiths to flash i can get them to come on fine but i cant get them to flash i need to get the lights to be on for 0.5 secounds then off for 0.5 secounds.
i have 6zones which represented by 6 lights and depending on the value of port it will make them on or off and what im trying to do is make them flash now and i dont know how.
how can i make them flash, i kinda want like a delay function which i can call upon so i can.
below is a bit of my code the bit that makes the lights come on
thankyou
i have 6zones which represented by 6 lights and depending on the value of port it will make them on or off and what im trying to do is make them flash now and i dont know how.
how can i make them flash, i kinda want like a delay function which i can call upon so i can.
below is a bit of my code the bit that makes the lights come on
Rich (BB code):
DDRA = 0xff;
mask = 1; //reset mask to one before each iteration
for (i = 0; i < 6; i++) // 6 lights soo loop 6 times
{
if(port & mask)
{
PORTA ^= mask;
}
else //if port=0 turn the lights off
{
PORTA = 0x00;
}
mask <<=1; //check next bit
}
thankyou