Skip to content
Snippets Groups Projects
Commit bf649b75 authored by pichlerbi76568's avatar pichlerbi76568
Browse files

change levels

parent c950f1f6
No related branches found
No related tags found
No related merge requests found
......@@ -536,14 +536,17 @@ uint32_t x = 0u;
/* USER CODE END Header_Task01 */
void Levels(void *argument)
{
matrix_s sendQueue;
int random;
int rand1;
int rand2;
int rand3;
int counter=0;
int number;
/* Infinite loop */
for(;;)
{
number=0;
if (counter <= 7)
{
random = 0;
......@@ -565,46 +568,42 @@ int counter=0;
if(random ==0)
{
rand2 =(rand()%4);
rand2 ++;
xQueueSend( toLEDMatrixHandle, ( void * ) &rand2, ( TickType_t ) 0 );
rand1 =(rand()%4);
number ^=(1 <<rand1);
}
if (random ==1)
else if (random ==1)
{
rand2 =(rand()%4);
rand3 =(rand()%3);
if (rand2 == rand3 & rand2 !=3)
rand1 =(rand()%4);
rand2 =(rand()%3);
if (rand1 == rand2 & rand1 !=3)
{
rand3 ++;
rand2 ++;
}
else{
rand3 --;
rand2 --;
}
xQueueSend( toLEDMatrixHandle, ( void * ) &rand2, ( TickType_t ) 0 );
xQueueSend( toLEDMatrixHandle, ( void * ) &rand3, ( TickType_t ) 0 );
number ^=(1 <<rand1);
number ^=(1 <<rand2);
}
if(random ==2)
else if(random ==2)
{
rand2 =(rand()%4);
rand2 ++;
for(int i=1; i<5; i++)
rand1 =(rand()%4);
for(int i =0; i<4; i++)
{
if ( i != rand2)
if (i!= rand1)
{
xQueueSend( toLEDMatrixHandle, ( void * ) &i, ( TickType_t ) 0 );
number ^=(1 <<i);
}
}
}
if(random ==3)
{
for(int i=1; i<5; i++)
else
{
xQueueSend( toLEDMatrixHandle, ( void * ) &i, ( TickType_t ) 0 );
}
number=15;
}
sendQueue.nextLED=number;
sendQueue.isRunning = true;
xQueueSend( toLEDMatrixHandle, &sendQueue, ( TickType_t ) 0 );
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment