Advertisement
joymonkey

Padawan Body code with LCD screen

Oct 15th, 2013
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 17.82 KB | None | 0 0
  1. // =======================================================================================
  2. // /////////////////////////Padawan Body Code v1.9X //////////////////////////////////////
  3. // =======================================================================================
  4. //                                 danf
  5. //                        Revised  Date: 10/21/13 (unofficial revision by PaulM)
  6. //
  7. //   Designed to be used with a second Arduino running the Padawan Dome code
  8. //              EasyTransfer and PS2X_lib libraries by Bill Porter
  9. //
  10. //
  11. //         Set Sabertooth 2x25 Dip Switches 1 and 2 Down, All Others Up
  12. //         For SyRen Packetized Serial Set Switches 1 and 2 Down, All Others Up
  13. //         For SyRen Simple Serial Set Switchs 2 & 4 Down, All Others Up
  14. //         Placed a 10K ohm resistor between S1 & GND on the SyRen 10 itself
  15. //
  16. //         (if using Lithium batteries set switch 3 Down on SyRen & Sabertooth 2x25)
  17. //
  18. //     Arduino Pins:             BotBoarduino Pins:
  19. //     D01 = MP3 Trigger RX*     D01 = MP3 Trigger RX*
  20. //     D05 = Syren10 S1**        D06 = PS2 DAT
  21. //     D06 = Sabertooth S2***    D07 = PS2 COM
  22. //     D07 = Sabertooth S1       D08 = PS2 ATT
  23. //     D08 = Dome RXI            D09 = PS2 CLK
  24. //     D10 = PS2 ATT             D10 = Dome RXI
  25. //     D11 = PS2 COM             D11 = Syren10 S1**
  26. //     D12 = PS2 DAT             D12 = Sabertooth S2***
  27. //     D13 = PS2 CLK             D13 = Sabertooth S1
  28. //      A4 = LCD DAT              A4 = LCD DAT
  29. //      A5 = LCD CLK              A5 = LCD CLK
  30. //                               D05 = used by internal speaker
  31. //       *If using MP3 Trigger in mode 1, connect MP3 Trigger RX to D03 instead
  32. //      **If using SyRen in mode 3, connect Syren S1 to D01 instead
  33. //     ***S2 is not needed for Sabertooth's serial mode
  34. //
  35. //************************** Set speed and turn here************************************//
  36.  
  37. byte drivespeed = 75; // 0-stop, 127-full speed.
  38. // Recommend beginner: 50 to 75, experienced: 100 to 127, I like 100
  39.  
  40. byte turnspeed = 45;   // the higher this number the faster it will spin in place, lower - easier to controll.
  41. // Recommend beginner: 40 to 50, experienced: 50 $ up, I like 75
  42.  
  43. byte ramping = 5;      // Ramping- the lower this number the longer R2 will take to speedup or slow down,
  44. // change this by incriments of 1
  45.  
  46. #define MP3TRIGGERMODE 1   // 0 for regular mode (MP3 Tirgger RX connects to Pin 1)
  47.                            // 1 for Software Serial mode (MP3 Trigger connects to Pin 3)
  48.  
  49. #define SYRENMODE 3     // 1=Simple Serial , 2=Packetized Software Serial (recommended), 3=Packetized Hardware Serial (S1 connects to Pin 1)
  50. // Do not use Simple Serial mode in close contact with people.
  51. // NOTE : you can't use MP3TRIGGERMODE 0 with SYRENMODE 3, since they both use Arduino Pin 1
  52.  
  53. int domeBaudeRate = 9600; // Set the Serial baude rate for the Syren motor controller
  54. // for packetized options are: 2400, 9600 (default), 19200 or 38400
  55. // for simple use 9600 .
  56.  
  57. byte domecompensation = 2;  // For controllers that centering problems, causing slight dome drift in one direction
  58. // use the lowest number with no drift
  59.  
  60. byte domespeed = 110;  // If using a speed controller for the dome, sets the top speed
  61.                        // Use a number up to 127
  62.  
  63. #define VOLJUMP 2     // Speed at which volume is adjusted (1=slowest 5=fastest)
  64. #define VOLLIMIT 100   // Quietest volume can be set to (0-255, higher=quieter, over 64 is pretty quiet)
  65.  
  66. #define LCD 0         // Connect to LCD via i2c (pins A4 & A5), default address #0 (A0-A2 not jumpered)
  67. // Backlight can be toggled on/off using R1 + Pad Left
  68. // (comment out if no LCD is connected)
  69.  
  70. #define AUTOMIN 5     // Minimum seconds between sounds in auto mode
  71. #define AUTOMAX 20    // Maximum seconds between sounds in auto mode
  72.  
  73. #define BOARDTYPE 1   // 0 for regular Arduino, 1 for BotBoarduino (uses different PS2, ST & dome pins)
  74.  
  75. ///////include libs and declare variables////////////////////////////
  76. #include <Sabertooth.h>
  77. #if (SYRENMODE==3)
  78. Sabertooth SyR(128);
  79. #endif
  80. #include <SoftwareSerial.h>
  81. #if (SYRENMODE==1)
  82. #include <SyRenSimplified.h>
  83. #endif
  84. #include <PS2X_lib.h>  //for v1.7
  85. #include <Servo.h>
  86. #include <MP3Trigger.h>
  87. #include <SoftEasyTransfer.h>
  88. #if defined(LCD)
  89. #include <Wire.h>
  90. #include <LiquidTWI.h> //this is the speedy i2C LCD library - get it here: http://forums.adafruit.com/viewtopic.php?f=19&t=21586
  91. LiquidTWI lcd(LCD);
  92. #endif
  93.  
  94. //////////////////////////////////////////////////////////////////
  95.  
  96. #if (MP3TRIGGERMODE==1)
  97. SoftwareSerial trigSerial = SoftwareSerial(2, 3);
  98. #endif
  99. MP3Trigger trigger;
  100. #if (BOARDTYPE==0)
  101.   #if (SYRENMODE<3)
  102.   SoftwareSerial SyRSerial(2, 5);
  103.   #endif
  104.   SoftwareSerial domeSerial(2, 8);
  105.   SoftwareSerial STSerial(2, 7);
  106. #else
  107.   #if (SYRENMODE<3)
  108.   SoftwareSerial SyRSerial(2, 11);
  109.   #endif
  110.   SoftwareSerial domeSerial(2, 10);
  111.   SoftwareSerial STSerial(2, 13);
  112. #endif
  113.  
  114. /////////////////////////////////////////////////////////////////
  115. Sabertooth ST(128, STSerial);
  116. #if (SYRENMODE==1)
  117. SyRenSimplified SyR(SyRSerial); // Use SWSerial as the serial port.
  118. #elif (SYRENMODE==2)
  119. Sabertooth SyR(128, SyRSerial);
  120. #endif
  121. SoftEasyTransfer ET;//create object
  122. #include <Servo.h>
  123.  
  124.  
  125. struct SEND_DATA_STRUCTURE{
  126.   //put your variable definitions here for the data you want to send
  127.   //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
  128.   int hpx; // hp movement
  129.   int hpy; // hp movement
  130.   int hpl; // hp light
  131.   int hpa; // hp automation
  132.   int dsp; // 0 = random, 1 = alarm, 5 = leia, 11 = alarm2, 100 = no change
  133. };
  134.  
  135. SEND_DATA_STRUCTURE domeData;//give a name to the group of data
  136.  
  137. PS2X ps2x; // create PS2 Controller Class
  138. int error = 0; // part of the ps2x lib
  139. byte type = 0; // part of the ps2x lib
  140. byte vibrate = 0; // part of the ps2x lib
  141. byte vol = 40; // 0 = full volume, 64+ = inaudible, 255 = off
  142. byte drive = 0; // 0 = drive motors off ( right stick disabled )
  143. byte automate = 0;
  144. unsigned long automateMillis = 0;
  145. byte automateDelay = random(5,20);// set this to min and max seconds between sounds
  146. int turnDirection = 20;
  147. byte action = 0;
  148. unsigned long DriveMillis = 0;
  149. int drivenum = 0;
  150. int sticknum = 0;
  151. int domenum = 0;
  152. int domenumset = 0; //used for ramping in servo mode
  153. int domeramping=(ramping*4);
  154. int turnnum = 0;
  155. #if defined(LCD)  
  156. byte lcdlight = 0; //used to toggle the LCD backlight on and off
  157. #endif
  158. //////////////set up run once//////////////////////////////////////////
  159.  
  160. void setup(){
  161.  
  162.  
  163. #if defined(LCD)  
  164.   lcd.begin(16, 2);// sets up the LCD's number of rows and columns  
  165.   lcd.clear();
  166.   lcd.setBacklight(LOW);
  167.   delay(200);
  168.   lcd.setBacklight(HIGH);
  169.   delay(200);
  170.   lcd.print("Starting up."); // Print a message to the LCD.
  171.   lcd.setBacklight(LOW);
  172.   delay(100);
  173.   lcd.setBacklight(HIGH);  
  174. #endif
  175. #if(SYRENMODE<3)
  176.   SyRSerial.begin(domeBaudeRate);
  177. #endif  
  178. #if(SYRENMODE==1)
  179.   SyR.motor(0);            
  180. #elif(SYRENMODE==2)
  181.   SyR.autobaud();
  182. #elif(SYRENMODE==3)
  183.   SabertoothTXPinSerial.begin(domeBaudeRate);
  184.   SyR.autobaud();
  185. #endif
  186.   STSerial.begin(9600);   // 9600 is the default baud rate for Sabertooth packet serial.
  187.   ST.autobaud();          // Send the autobaud command to the Sabertooth controller(s).
  188.   // NOTE: *Not all* Sabertooth controllers need this command.
  189.   //       It doesn't hurt anything, but V2 controllers use an
  190.   //       EEPROM setting (changeable with the function setBaudRate) to set
  191.   //       the baud rate instead of detecting with autobaud.
  192.   //
  193.   //       If you have a 2x12, 2x25 V2, 2x60 or SyRen 50, you can remove
  194.   //       the autobaud line and save yourself two seconds of startup delay.
  195.  
  196.   ST.drive(0); // The Sabertooth won't act on mixed mode packet serial commands until
  197.   ST.turn(0);  // it has received power levels for BOTH throttle and turning, since it
  198.   // mixes the two together to get diff-drive power levels for both motors.
  199.   #if (MP3TRIGGERMODE==1)
  200.   trigger.setup(&trigSerial);
  201.   trigSerial.begin( MP3Trigger::serialRate() );
  202.   #else
  203.   trigger.setup(&Serial);
  204.   #endif
  205.  
  206. #if (BOARDTYPE==0)
  207.   error = ps2x.config_gamepad(13,11,10,12, true, false);   //setup pins and settings:  GamePad(clock, command, attention, data, Pressures?, Rumble?) check for error
  208. #else
  209.   error = ps2x.config_gamepad(9,7,8,6, true, false);   //setup pins and settings:  GamePad(clock, command, attention, data, Pressures?, Rumble?) check for error
  210. #endif
  211.  
  212.   trigger.setVolume(vol);//anything with trigger. is for the mp3trigger
  213.   type = ps2x.readType();
  214.   domeSerial.begin(57600);//start the library, pass in the data details and the name of the serial port.
  215.   ET.begin(details(domeData), &domeSerial);
  216.  
  217. #if defined(LCD)  
  218.   lcd.clear();    
  219.   lcd.print("PADAWAN"); // Print a message to the LCD.
  220.   delay(250);
  221.   lcd.setBacklight(LOW);
  222. #endif
  223.  
  224. }
  225.  
  226. ///////function to play sound (also outputs to LCD if connected)////////////////
  227. void playSound(int soundNumber) {
  228. #if defined(LCD)
  229.   lcd.setCursor(0, 0);
  230.   lcd.print("Sound "+String(soundNumber)+" ");
  231. #endif
  232.   trigger.play(soundNumber);
  233. }
  234. ////////////////////////////////////////////////////////////////////////////////////////////
  235.  
  236. ///////Loop run over and over//////////////////////////////////////
  237. //////////////////////////////////////////////////////////////////
  238.  
  239. void loop(){
  240.  
  241.   if(error == 1) //skip loop if no controller found
  242.     return;
  243.  
  244.   ps2x.read_gamepad();   //read controller and set large motor to spin at 'vibrate' speed
  245.  
  246.     //// enable / disable right stick & play sound
  247.   if(ps2x.ButtonPressed(PSB_START))
  248.   {
  249.     if (drive<1)
  250.     {
  251. #if defined(LCD)
  252.       lcd.setCursor(0, 1);
  253.       lcd.print("-Drive  Enabled-");
  254. #endif
  255.       drive = 1;
  256.       playSound(52);
  257.     }
  258.     else {
  259. #if defined(LCD)
  260.       lcd.setCursor(0, 1);
  261.       lcd.print("-Drive Disabled-");
  262. #endif
  263.       drive = 0;
  264.       playSound(53);
  265.     }
  266.   }
  267.  
  268.   ////turn hp automation or automate on & off      
  269.   if(ps2x.ButtonPressed(PSB_SELECT)) {
  270.  
  271.     if(ps2x.Button(PSB_R2)) {
  272.       if(domeData.hpa == 1) {
  273. #if defined(LCD)
  274.         lcd.setCursor(0, 1);
  275.         lcd.print(" -Auto HP OFF-  ");
  276. #endif  
  277.         domeData.hpa = 0;
  278.         domeData.dsp = 100;
  279.         ET.sendData();
  280.       }
  281.       else {//if hp automation is off, turn it on
  282. #if defined(LCD)
  283.         lcd.setCursor(0, 1);
  284.         lcd.print("  -Auto HP ON-  ");
  285. #endif  
  286.         domeData.hpa = 1;
  287.         domeData.dsp = 100;
  288.         ET.sendData();
  289.       }//turn hp automation off  
  290.     }
  291.  
  292.     /////////////automate
  293.     else {
  294.       if (automate<1) {
  295. #if defined(LCD)
  296.         lcd.setCursor(0, 1);
  297.         lcd.print(" -Automate  ON-  ");
  298. #endif
  299.         automate = 1;
  300.         playSound(52);
  301.       }
  302.       else {
  303. #if defined(LCD)
  304.         lcd.setCursor(0, 1);
  305.         lcd.print(" -Automate OFF- ");
  306. #endif
  307.         automate = 0;
  308.         action = 0;
  309.         playSound(53);
  310.       }
  311.     }
  312.   }
  313.  
  314.   if (automate == 1)
  315.   {
  316.     if (ps2x.Analog(PSS_LX)!=128)
  317.     {
  318.       automateMillis = millis();
  319.     }
  320.     unsigned long currentMillis = millis();
  321.     if (currentMillis - automateMillis > (automateDelay*1000))
  322.     {
  323.       automateMillis = millis();
  324.       action = random(1,5);
  325.       if (action>1)
  326.       {
  327.         (playSound(random(32,52)));
  328.       }
  329.       if (action<4)
  330.       {
  331. #if (SYRENMODE==1)        
  332.         SyR.motor(turnDirection);
  333. #elif(SYRENMODE>=2)
  334.         SyR.motor(1,turnDirection);
  335. #endif
  336.         delay(750);
  337. #if(SYRENMODE==1)
  338.         SyR.motor(0);
  339. #elif(SYRENMODE>=2)
  340.         SyR.motor(1,0);
  341. #endif
  342.         if (turnDirection>0)
  343.         {
  344.           turnDirection = -49;
  345.         }
  346.         else
  347.         {
  348.           turnDirection = 45;
  349.         }
  350.       }
  351.       automateDelay = random(AUTOMIN,AUTOMAX);// set this to min and max seconds between sounds
  352.     }
  353.   }
  354.   ////volume control
  355.   if(ps2x.Button(PSB_PAD_UP))
  356.   {
  357.     if(ps2x.Button(PSB_R1))
  358.     {
  359.       if (vol>0)
  360.       {
  361.         vol=vol-VOLJUMP;
  362.         if(vol<0) vol=0;
  363. #if defined(LCD)
  364.         lcd.setCursor(9, 0);
  365.         lcd.print("Vol "+String(vol)+"  ");
  366. #endif
  367.         trigger.setVolume(vol);
  368.       }// volume up
  369.     }  
  370.   }
  371.   if(ps2x.Button(PSB_PAD_DOWN))
  372.   {
  373.     if(ps2x.Button(PSB_R1))
  374.     {
  375.       if (vol<VOLLIMIT)
  376.       {
  377.         vol=vol+VOLJUMP;
  378.         if(vol>VOLLIMIT) vol=VOLLIMIT;
  379. #if defined(LCD)
  380.         lcd.setCursor(9, 0);
  381.         lcd.print("Vol "+String(vol)+"  ");
  382. #endif
  383.         trigger.setVolume(vol);
  384.       }//volume down
  385.     }
  386.   }
  387.  
  388.   ////LCD backlight toggle on/off
  389. #if defined(LCD)
  390.   if(ps2x.Button(PSB_PAD_LEFT))
  391.   {
  392.     if(ps2x.Button(PSB_R1))
  393.     {
  394.       if (lcdlight==0)
  395.       { //turn on backlight
  396.         lcd.setBacklight(HIGH);
  397.         lcdlight=1;
  398.       }
  399.       else
  400.       { //turn off backlight
  401.         lcd.setBacklight(LOW);
  402.         lcdlight=0;
  403.       }
  404.     }  
  405.   }
  406. #endif
  407.  
  408.  
  409.  
  410.   /////hp movement
  411.   if(ps2x.ButtonPressed(PSB_PAD_UP))
  412.   {
  413.     if (!(ps2x.Button(PSB_R1)))
  414.     {
  415.       domeData.hpy = 30;
  416.       domeData.dsp = 100;
  417.       ET.sendData();
  418.     }
  419.   }
  420.   if(ps2x.ButtonPressed(PSB_PAD_DOWN))
  421.   {
  422.     if (!(ps2x.Button(PSB_R1)))
  423.     {
  424.       domeData.hpy = 150;
  425.       domeData.dsp = 100;
  426.       ET.sendData();
  427.     }
  428.   }
  429.   if(ps2x.ButtonReleased(PSB_PAD_UP)||ps2x.ButtonReleased(PSB_PAD_DOWN))
  430.   {
  431.     domeData.hpy = 0;
  432.     domeData.dsp = 100;
  433.     ET.sendData();
  434.   }
  435.  
  436.   if(ps2x.ButtonPressed(PSB_PAD_RIGHT))
  437.   {
  438.     domeData.hpx = 150;
  439.     domeData.dsp = 100;
  440.     ET.sendData();
  441.   }
  442.   if(ps2x.ButtonPressed(PSB_PAD_LEFT))
  443.   {
  444.     domeData.hpx = 30;
  445.     domeData.dsp = 100;
  446.     ET.sendData();
  447.   }
  448.   if(ps2x.ButtonReleased(PSB_PAD_RIGHT)||ps2x.ButtonReleased(PSB_PAD_LEFT))
  449.   {
  450.     domeData.hpx = 0;
  451.     domeData.dsp = 100;
  452.     ET.sendData();
  453.   }
  454.  
  455.  
  456.   /////play sounds and change display
  457.   if(ps2x.ButtonPressed(PSB_GREEN))//triangle top
  458.   {
  459.     if(ps2x.Button(PSB_L1))
  460.     {
  461.       (playSound(8));
  462.       domeData.dsp = 0;
  463.       ET.sendData();
  464.     }
  465.     else if(ps2x.Button(PSB_L2))
  466.     {
  467.       (playSound(2));
  468.       domeData.dsp = 0;
  469.       ET.sendData();
  470.     }
  471.     else if(ps2x.Button(PSB_R1))
  472.     {
  473.       (playSound(9));
  474.       domeData.dsp = 0;
  475.       ET.sendData();
  476.     }
  477.     else
  478.     {
  479.       (playSound(random(13,17)));
  480.       domeData.dsp = 0;
  481.       ET.sendData();
  482.     }
  483.   }
  484.   if(ps2x.ButtonPressed(PSB_BLUE))//x bottom
  485.   {
  486.     if(ps2x.Button(PSB_L1))
  487.     {
  488.       (playSound(6));
  489.       domeData.dsp = 0;
  490.       ET.sendData();
  491.     }
  492.     else if(ps2x.Button(PSB_L2))
  493.     {
  494.       (playSound(1));
  495.       domeData.dsp = 1;
  496.       ET.sendData();
  497.       domeData.dsp = 0;
  498.     }
  499.     else if(ps2x.Button(PSB_R1))
  500.     {
  501.       (playSound(11));
  502.       domeData.dsp = 11;
  503.       ET.sendData();
  504.       domeData.dsp = 0;
  505.     }
  506.     else
  507.     {
  508.       (playSound(random(17,25)));
  509.       domeData.dsp = 0;
  510.       ET.sendData();
  511.     }
  512.   }
  513.   if(ps2x.ButtonPressed(PSB_RED))//circle right
  514.   {
  515.     if(ps2x.Button(PSB_L1))
  516.     {
  517.       (playSound(7));
  518.       domeData.dsp = 0;
  519.       ET.sendData();
  520.     }
  521.     else if(ps2x.Button(PSB_L2))
  522.     {
  523.       (playSound(3));
  524.       domeData.dsp = 0;
  525.       ET.sendData();
  526.     }
  527.     else if(ps2x.Button(PSB_R1))
  528.     {
  529.       (playSound(10));
  530.       domeData.dsp = 0;
  531.       ET.sendData();
  532.     }
  533.     else
  534.     {
  535.       (playSound(random(32,52)));
  536.       domeData.dsp = 0;
  537.       ET.sendData();
  538.     }
  539.   }
  540.   if(ps2x.ButtonPressed(PSB_PINK))//square left
  541.   {
  542.     if(ps2x.Button(PSB_L1))
  543.     {
  544.       (playSound(5));
  545.       domeData.dsp = 5;
  546.       ET.sendData();
  547.       domeData.dsp = 0;
  548.     }
  549.     else if(ps2x.Button(PSB_L2))
  550.     {
  551.       (playSound(4));
  552.       domeData.dsp = 0;
  553.       ET.sendData();
  554.     }
  555.     else if(ps2x.Button(PSB_R1))
  556.     {
  557.       (playSound(12));
  558.       domeData.dsp = 0;
  559.       ET.sendData();
  560.     }
  561.     else
  562.     {
  563.       (playSound(random(25,32)));
  564.       domeData.dsp = 0;
  565.       ET.sendData();
  566.     }
  567.   }
  568.  
  569.   ////turn hp light on & off      
  570.   if(ps2x.ButtonPressed(PSB_L3)) //left joystick
  571.   {
  572.     if(domeData.hpl == 1)
  573.     {
  574.       domeData.hpl = 0;
  575.       domeData.dsp = 100;
  576.       ET.sendData();
  577.     }//if hp light is on, turn it off
  578.     else
  579.     {
  580.       domeData.hpl = 1;
  581.       domeData.dsp = 100;
  582.       ET.sendData();
  583.     }//turn hp light on
  584.   }  
  585.  
  586.   /////foot drives
  587.   /////////////////new stuff//////////////////
  588.   sticknum = (map(ps2x.Analog(PSS_RY), 0, 255, -drivespeed, drivespeed));
  589.  
  590.   if (drivenum < sticknum)
  591.   {
  592.     if (sticknum-drivenum<(ramping+1))
  593.       drivenum+=ramping;
  594.     else
  595.       drivenum = sticknum;
  596.  
  597.   }
  598.  
  599.   else if (drivenum > sticknum)
  600.   {
  601.     if (drivenum-sticknum<(ramping+1))
  602.       drivenum-=ramping;
  603.     else
  604.       drivenum = sticknum;
  605.  
  606.   }
  607.  
  608.  
  609.   turnnum = (ps2x.Analog(PSS_RX));  
  610.   if (turnnum <= 200 && turnnum >= 54)
  611.     turnnum = (map(ps2x.Analog(PSS_RX), 54, 200, -(turnspeed/3), (turnspeed/3)));
  612.   else if (turnnum > 200)
  613.     turnnum = (map(ps2x.Analog(PSS_RX), 201, 255, turnspeed/3, turnspeed));
  614.   else if (turnnum < 54)
  615.     turnnum = (map(ps2x.Analog(PSS_RX), 0, 53, -turnspeed, -(turnspeed/3)));
  616.  
  617.   //////////////////////////////////
  618.   if (drive == 1)// right stick (drive)
  619.   {    
  620. #if defined(LCD)
  621.     /*lcd.setCursor(6, 1);
  622.      lcd.print("Tu"+String(turnnum)+" Dr"+String(drivenum)+"   ");*/
  623. #endif
  624.     ST.turn(turnnum);
  625.     ST.drive(drivenum);
  626.   }
  627.  
  628.   /////dome drive
  629.   domenum = (map(ps2x.Analog(PSS_LX), 0, 255, -domespeed, domespeed));
  630.   if (domenum > domecompensation && domenum < domecompensation) domenum = 0;
  631.  
  632. #if defined(LCD)
  633.   lcd.setCursor(0, 1);
  634.   lcd.print("Sy"+String(domenum)+"   ");
  635. #endif
  636. #if(SYRENMODE==1)
  637.   SyR.motor(domenum);
  638. #elif(SYRENMODE>=2)
  639.   SyR.motor(1,domenum);
  640. #endif
  641.  
  642.   ////////////
  643.   delay(50);
  644. }
  645. /////////////////////////////////////////////////////////////////
  646. //////////////////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement