Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ATX2.h>
- void setup()
- {
- XIOinit();
- glcdClear();
- glcdMode(1);
- setTextSize(2);
- setTextColor(GLCD_ORANGE);
- glcd(2,0,"Disconnect ");
- glcd(3,0,"Receiver ");
- glcd(4,0,"from (3) TxD1");
- glcd(5,0,"and push (OK)");
- }
- void loop()
- {
- int RF_Channel;
- while(1)
- {
- RF_Channel=knob(197);
- if (RF_Channel<5)
- RF_Channel=5;
- if (RF_Channel>197)
- RF_Channel=197;
- setTextSize(3);
- setTextColor(GLCD_DOLLAR);
- glcd(0,0,"RF:");
- setTextColor(GLCD_YELLOW);
- glcd(0,3,"%d ",RF_Channel);
- setTextSize(1);
- setTextColor(GLCD_WHITE);
- glcd(3,10,"^-- Turn KNOB");
- delay(100);
- setTextSize(2);
- if (sw_OK())
- {
- pinMode(3,OUTPUT);
- digitalWrite(3,LOW);
- beep();
- setTextColor(GLCD_GREEN);
- glcd(2,0,"CONNECT... ");
- glcd(3,0,"Receiver to 3");
- glcd(4,0,"and push (OK)");
- glcd(5,0,"within 3 sec.");
- while(!sw_OK());
- digitalWrite(3,HIGH);
- delay(200);
- Serial1.begin(9600);
- delay(2000);
- Serial1.write('C');
- Serial1.write('H');
- Serial1.write(RF_Channel);
- Serial1.flush();
- setTextColor(GLCD_PINK);
- glcd(2,0," ");
- glcd(3,0," ");
- glcd(4,0,"Programmed OK.");
- glcd(5,0," ");
- Serial1.end();
- delay(1000);
- setTextColor(GLCD_ORANGE);
- glcd(2,0,"Disconnect ");
- glcd(3,0," Receiver ");
- glcd(4,0,"from TxD1 pin");
- glcd(5,0,"and push (OK)");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment