Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <popxt.h>
- void setup()
- {
- int i,j,r,g,b;
- delay(250);
- glcdMode(1);
- glcdSetColorWordRGB();
- glcdClear();
- sound(1000,100);
- delay(50);
- sound(1400,50);
- for (j=0;j<=124;j+=4)
- {
- for (i=0;i<160;i++)
- {
- if (i<32)
- {
- r=(32-i)-(j/4)-1;
- g=(i<<1)-((j/4)<<1)-1;
- b=0;
- }
- else if (i<64)
- {
- r=0;
- g=(64-((i-32)<<1))-((j/4)<<1)-1;
- b=(i-32)-(j/4)-1;
- }
- else if (i<96)
- {
- r=(i-64)-(j/4)-1;
- g=0;
- b=(96-(i-64))-(j/4)-1;
- }
- else //if (i<128)
- {
- r=(160-(i-96))-(j/4)-1;
- g=(((160-(i-96))-(j/4))<<1)-1;
- b=(160-(i-96))-(j/4)-1;
- }
- if (sw_ok()) break;
- glcdLine(i,j,i,j+4,(r<<11)|(g<<5)|b);
- }
- }
- if (!sw_ok())
- {
- for (i=0;i<100;i++)
- {
- delay(10);
- if (sw_ok()) break;
- }
- __tft.writecommand(GCLCD_INVON);
- for (i=0;i<100;i++)
- {
- delay(10);
- if (sw_ok()) break;
- }
- __tft.writecommand(GCLCD_INVOFF);
- for (i=0;i<100;i++)
- {
- delay(10);
- if (sw_ok()) break;
- }
- }
- glcdFillRect(-1,0,160,128,GLCD_WHITE);
- for (i=0;i<100;i++)
- {
- delay(10);
- if (sw_ok()) break;
- }
- glcdFillRect(-1,0,160,128,GLCD_RED);
- for (i=0;i<100;i++)
- {
- delay(10);
- if (sw_ok()) break;
- }
- glcdFillRect(-1,0,160,128,GLCD_GREEN);
- for (i=0;i<100;i++)
- {
- delay(10);
- if (sw_ok()) break;
- }
- glcdFillRect(-1,0,160,128,GLCD_BLUE);
- for (i=0;i<100;i++)
- {
- delay(10);
- if (sw_ok()) break;
- }
- glcdClear();
- setTextSize(2);
- glcdFillRect(14,12,134,30,GLCD_BLUE);
- setTextColor(GLCD_WHITE);
- setTextBackgroundColor(GLCD_BLUE);
- glcd(1,2,"POP-XT/XT+");
- setTextSize(1);
- setTextBackgroundColor(GLCD_BLACK);
- setTextColor(GLCD_WHITE);
- glcd(5,3,"LCD mode ");
- setTextColor(GLCD_RED);
- glcd(5,12,"R");
- setTextColor(GLCD_GREEN);
- glcd(5,13,"G");
- setTextColor(GLCD_BLUE);
- glcd(5,14,"B");
- setTextColor(GLCD_YELLOW);
- glcd(6,3,"glcdSetColorWordRGB();");
- setTextColor(GLCD_GREEN);
- glcd(8,5,"Motor & Servo test");
- while(sw_ok());
- setTextColor(GLCD_MAGENTA);
- glcd(10,7,"Wait for");
- servo(1,45);
- servo(2,90);
- servo(3,135);
- while(!sw_ok())
- {
- glcdRect(95,97,24,14,GLCD_YELLOW);
- setTextColor(GLCD_YELLOW);
- glcd(10,17,"OK");
- for(i=0;i<20;i++)
- {
- delay(10);
- if (sw_ok())
- break;
- }
- glcdRect(95,97,24,14,GLCD_BLACK);
- setTextColor(GLCD_BLACK);
- glcd(10,17,"OK");
- for(i=0;i<20;i++)
- {
- delay(10);
- if (sw_ok())
- break;
- }
- }
- setTextColor(GLCD_SKY);
- glcd(9,4," > Running test ");
- setTextColor(0b1111110000001000);
- glcd(10,4,"KNOB set motor power");
- setTextColor(GLCD_MAGENTA);
- glcd(12,4,"servo 45,90,135 test");
- }
- int value;
- void loop(){
- sound(1200,15);
- motor(1,100);
- motor(2,0);
- delay(750);
- motor(1,0);
- motor(2,100);
- delay(750);
- motor(1,-100);
- motor(2,0);
- delay(750);
- motor(1,0);
- motor(2,-100);
- delay(750);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement