Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #include <ipst.h>
  2. int i=0;
  3. char x[13];
  4. void setup(){
  5.   // Send Reset Command
  6.   out(17,0);delay(100);
  7.   out(17,1);delay(1000);
  8.   // Baudrate 2400
  9.   Serial1.begin(2400);
  10.   // Read ZX-SERVO16i Version
  11.   Serial1.println("!SCVER?");
  12.   while(!Serial1.available());
  13.   delay(300);
  14.   while(Serial1.available()>0){
  15.     x[i]=Serial1.read();
  16.     i++;    
  17.   }
  18.   // Show at GLCD line 1
  19.   glcd(0,0,x);
  20.   i=0;
  21.   // Change ZX-SERVO16i baudrate to 38400
  22.   Serial1.print("!SCSBR");
  23.   Serial1.write(1);
  24.   Serial1.write(0x0D);
  25.   Serial1.write(0x0A);
  26.   delay(1000);
  27.   // Change baudrate to 38400
  28.   Serial1.end();
  29.   Serial1.begin(38400);
  30.   // Check VERSION again
  31.   Serial1.println("!SCVER?");
  32.   while(!Serial1.available());
  33.   delay(100);
  34.   while(Serial1.available()>0){
  35.     x[i]=Serial1.read();
  36.     i++;    
  37.   }
  38.   // Show GLCD line 3
  39.   glcd(2,0,x);
  40. }
  41. void loop(){}