Hello everyone!
I have recently improved and finished some code that I made that displays the Delta logo while scrolling through the colors. It took me some time to draw the logo out using lines but I was pleasantly pleased with the outcome. After I made the logo and made the functions, I compressed the code a bit more to make it look simpler and a bit more easier on size as well. I hope you enjoy!
#include "robot-config.h"
/*/////////////////////////////////*/
/* Rainbow Delta Logo */
/* By Connor, 1814D */
/*/////////////////////////////////*/
int rainbowlogo(){
int color1 = 0;
int a;
int b;
int c;
int d;
while(1==1){
//Reset values a, b, c, and d
a = b = c = d = 0;
//Create Random Colors Every Loop
color1++;
if(color1 >= 7) color1 = 0;
if(color1 == 0)Brain.Screen.setPenColor(color::red);
else if(color1 == 1) Brain.Screen.setPenColor(color::green);
else if(color1 == 2) Brain.Screen.setPenColor(color::blue);
else if(color1 == 3) Brain.Screen.setPenColor(color::yellow);
else if(color1 == 4) Brain.Screen.setPenColor(color::purple);
else if(color1 == 5) Brain.Screen.setPenColor(color::orange);
else if(color1 == 6) Brain.Screen.setPenColor(color::cyan);
//Draw Rainbow Circle
Brain.Screen.setPenWidth(5);
Brain.Screen.drawCircle(240, 120, 105);
Brain.Screen.setPenWidth(2);
//Draw Rainbow Line
for(int j = 1; j <= 6; j ++){
Brain.Screen.drawLine(170 - a, 160, 240 + b, 40 - a);
a -= 2;
b++;
}
Brain.Screen.setPenColor(color::white);
//Draw 2 White Lines
for(int k = 1; k <= 6; k ++){
Brain.Screen.drawLine(250 - c, 60 + d, 310 - d, 160);
Brain.Screen.drawLine(190 + c, 161 - d, 301, 161 - d);
d++;
Brain.Screen.drawLine(250 - c, 60 + d, 310 - d, 160);
Brain.Screen.drawLine(190 + c, 161 - d, 301, 161 - d);
c++;
d++;
}
task::sleep(1000);
}
}
int main(){
vex::task rainbow(rainbowlogo); //Starts rainbowlogo with the task nickname of "rainbow"
//rainbow.stop(); //Stops task rainbow
}
I also added it into its own task in which it would be ran by βint main(){}β to help show how to start and stop tasks as well.
EDIT//: Hereβs the code displayed on the V5 Brain: