Hello all. So, I have seen several forum posts on the idea of using LED lights to indicate the program you are using for autonomous. I have tried to apply what others have done to my program and can’t seem to do it correctly. I currently am using EasyC V4 and have an autonomous selector (potentiometer) with seven programs I can select. What I would love to do is have a light that either did different colors or several lights that did patterns so that I could see exactly what program I am running. The summary of my code (most likely with errors) is below. If I could have a combo of LED lights or one that did a different color for each program, that would be awesome. Thanks!
#include "Main.h"
void Autonomous ( unsigned long ulTime )
{
int Button1;
int Potentiometer;
int LineFollow;
while ( 1 )
{
DefineRobotMotors ( 2 , 1 , 4 , 5 , 7 , 6 , 1 , 0 , 0 , 1 ) ; // Drive defined
Potentiometer = GetAnalogInput ( 1 ) ;
Button1 = 1 ;
Button1 = GetDigitalInput ( 1 ) ;
LineFollow = GetAnalogInput ( 2 ) ;
LineFollow = 1 ;
if ( Potentiometer > 1 && Potentiometer < 85 )
{Code still in progress
}
if ( Potentiometer >= 85 && Potentiometer < 255 )
{Code still in progress
}
if ( Potentiometer >= 255 && Potentiometer < 425 ) // Do "nothing"
{
MultiMotorTimeControl ( 2 , 8 , 9 , 6 , 7 , 0 , 1 , 0 , 0 , 127 , 500 ) ;
Wait ( 2000 ) ;
MultiMotorTimeControl ( 4 , 10 , 1 , 3 , 2 , 1 , 0 , 0 , 1 , 127 , 500 ) ;
Wait ( 1000 ) ;
MultiMotorTimeControl ( 2 , 8 , 9 , 6 , 7 , 0 , 1 , 0 , 0 , -127 , 2000 ) ;
Wait ( 14000 ) ;
}
if ( Potentiometer >= 425 && Potentiometer < 595 ) // Hang zone 1
{
MultiMotorTimeControl ( 2 , 8 , 9 , 6 , 7 , 0 , 1 , 0 , 0 , 127 , 150 ) ;
Code removed for simplicity
}
if ( Potentiometer >= 595 && Potentiometer < 765 ) // Hang zone 2
{Code still in progress
}
if ( Potentiometer >= 765 && Potentiometer < 935 ) // Goal zone autonomous 1
{
MultiMotorTimeControl ( 2 , 8 , 9 , 6 , 7 , 0 , 1 , 0 , 0 , 127 , 750 ) ;
Code removed for simplicity
}
else if ( Potentiometer >= 935 && Potentiometer < 1024 ) // Hang zone Pneumatics
{
MultiMotorTimeControl ( 2 , 8 , 9 , 6 , 7 , 0 , 1 , 0 , 0 , 127 , 750 ) ;
Code removed for simplicity
}
}
}
The brackets may have gotten messed up a bit because I had to delete some of the code to make it fit on here. However, that is the basic structure of my code. Thanks again!