SHARE
TWEET

Untitled

a guest Jun 8th, 2017 540 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. Conversation opened. 1 read message.
  3.  
  4. Skip to content
  5. Using Gmail with screen readers
  6. Search
  7.  
  8.  
  9.  
  10. Gmail
  11. COMPOSE
  12. Labels
  13. Inbox (974)
  14. Starred
  15. Important
  16. Sent Mail
  17. Drafts
  18. Personal
  19. Travel
  20. More
  21. Hangouts
  22.  
  23.  
  24.  
  25.  
  26.   More
  27. 1 of 1,571  
  28.  
  29. Print all In new window
  30. Fwd: bagi
  31. Inbox
  32. x
  33.  
  34. Milos Tomic
  35. Attachments9:33 AM (10 hours ago)
  36.  
  37. to me
  38. ---------- Forwarded message ----------
  39. From: "Nebojsa Sapic" <sapic94@gmail.com>
  40. Date: Jun 7, 2017 21:00
  41. Subject: Fwd: bagi
  42. To: <milost1995@gmail.com>
  43. Cc:
  44.  
  45.  
  46.  
  47. Sent from my iPhone
  48.  
  49. Begin forwarded message:
  50.  
  51. From: Djole Savic <djole12@gmail.com>
  52. Date: June 5, 2017 at 19:10:04 GMT+2
  53. To: Nebojsa Sapic <sapic94@gmail.com>
  54. Subject: bagi
  55. Attachments area
  56.    
  57. Click here to Reply or Forward
  58. 1.62 GB (10%) of 15 GB used
  59. Manage
  60. Terms - Privacy
  61. Last account activity: 25 minutes ago
  62. Details
  63. Milos Tomic
  64. milost1995@gmail.com
  65.  
  66. Show details
  67.  
  68. sbit BREAK_LAMPS at GPIOE_ODR.B1;
  69.  
  70. sbit HEAD_LAMPS at GPIOE_ODR.B3;
  71.  
  72. sbit TURN_L at GPIOC_ODR.B4;
  73.  
  74. sbit TURN_R at GPIOE_ODR.B2;
  75.  
  76. sbit MAIN_BEAM at GPIOB_ODR.B6;
  77.  
  78.  
  79.  
  80. //BUGGY COMMANDS
  81.  
  82. #define CMD_DRIVE                0x01
  83.  
  84. #define CMD_BREAK                0x02
  85.  
  86. #define CMD_RESPOND              0x03
  87.  
  88. #define CMD_SPIN                 0x04
  89.  
  90.  
  91.  
  92. unsigned int SPEED_L;
  93.  
  94. unsigned int SPEED_R;
  95.  
  96.  
  97.  
  98. unsigned int PWM_A_PERIOD;
  99.  
  100. unsigned int PWM_B_PERIOD;
  101.  
  102. unsigned int PWM_C_PERIOD;
  103.  
  104. unsigned int PWM_D_PERIOD;
  105.  
  106.  
  107.  
  108. extern char writeBuff[32];
  109.  
  110. extern short readBuff[32];
  111.  
  112.  
  113.  
  114. char old_cmd = CMD_BREAK;
  115.  
  116. char txPipe;
  117.  
  118.  
  119.  
  120.  
  121.  
  122. void Init_Buggy() {
  123.  
  124. //GPIO
  125.  
  126.   GPIO_Digital_Output (&GPIOE_BASE, _GPIO_PINMASK_1 | _GPIO_PINMASK_2 | _GPIO_PINMASK_3);
  127.  
  128.   GPIO_Digital_Output (&GPIOB_BASE, _GPIO_PINMASK_6);
  129.  
  130.   GPIO_Digital_Output (&GPIOC_BASE, _GPIO_PINMASK_4);
  131.  
  132.  
  133.  
  134. //BAT VSENSE
  135.  
  136.   ADC_Set_Input_Channel(_ADC_CHANNEL_13); //ADC on PC3
  137.  
  138.   Adc1_Init();
  139.  
  140.  
  141.  
  142. //PWM
  143.  
  144.   SPEED_L = 0;
  145.  
  146.   SPEED_R = 0;
  147.  
  148.   PWM_A_PERIOD = PWM_TIM4_Init(20000);
  149.  
  150.   PWM_B_PERIOD = PWM_TIM4_Init(20000);//PWM_A_PERIOD;
  151.  
  152.   PWM_C_PERIOD = PWM_TIM9_Init(20000);
  153.  
  154.   PWM_D_PERIOD = PWM_TIM3_Init(20000);
  155.  
  156.  
  157.  
  158.   PWM_TIM4_Set_Duty(0,  _PWM_NON_INVERTED, _PWM_CHANNEL3);
  159.  
  160.   PWM_TIM4_Set_Duty(0,  _PWM_NON_INVERTED, _PWM_CHANNEL4);
  161.  
  162.   PWM_TIM9_Set_Duty(0,  _PWM_NON_INVERTED, _PWM_CHANNEL1);
  163.  
  164.   PWM_TIM3_Set_Duty(0,  _PWM_NON_INVERTED, _PWM_CHANNEL3);
  165.  
  166.  
  167.  
  168.  
  169.  
  170. }
  171.  
  172. //postavljanje na koliko vremena ce se lampice paliti
  173.  
  174. void HeadLamps_Blink() {
  175.  
  176.   HEAD_LAMPS = 1;
  177.  
  178.   delay_ms(200);
  179.  
  180.   HEAD_LAMPS = 0;
  181.  
  182.   delay_ms(500);
  183.  
  184.   HEAD_LAMPS = 1;
  185.  
  186.   delay_ms(200);
  187.  
  188.   HEAD_LAMPS = 0;
  189.  
  190. }
  191.  
  192.  
  193.  
  194. //red blinkanja lapmica
  195.  
  196. void TurnLamps_Blink() {
  197.  
  198.   char n;
  199.  
  200.  
  201.  
  202.   for(n=0; n<7; n++) {
  203.  
  204.     TURN_L = ~ TURN_L;
  205.  
  206.     TURN_R = ~ TURN_R;
  207.  
  208.     delay_ms(200);
  209.  
  210.   }
  211.  
  212.   TURN_L = 0;
  213.  
  214.   TURN_R = 0;
  215.  
  216. }
  217.  
  218.  
  219.  
  220. //red blinkaca desnih lampica
  221.  
  222. void TurnLamps_Blink_R() {
  223.  
  224.   char n;
  225.  
  226.  
  227.  
  228.   for(n=0; n<7; n++) {
  229.  
  230.     TURN_R = ~ TURN_R;
  231.  
  232.     delay_ms(200);
  233.  
  234.   }
  235.  
  236.   TURN_R = 0;
  237.  
  238. }
  239.  
  240.  
  241.  
  242. //ugasiti lampice
  243.  
  244. void Lights_Off() {
  245.  
  246.  
  247.  
  248. }
  249.  
  250.  
  251.  
  252. //zaustaviti buggy-ja
  253.  
  254. void Break_Buggy() {
  255.  
  256.   SPEED_L = 0;
  257.  
  258.   SPEED_R = 0;
  259.  
  260.   PWM_TIM4_Set_Duty(0,  _PWM_NON_INVERTED, _PWM_CHANNEL3);
  261.  
  262.   PWM_TIM4_Set_Duty(0,  _PWM_NON_INVERTED, _PWM_CHANNEL4);
  263.  
  264.   PWM_TIM9_Set_Duty(0,  _PWM_NON_INVERTED, _PWM_CHANNEL1);
  265.  
  266.   PWM_TIM3_Set_Duty(0,  _PWM_NON_INVERTED, _PWM_CHANNEL3);
  267.  
  268. }
  269.  
  270.  
  271.  
  272. static void Full_Circle_Left() {
  273.  
  274.   double dbl_temp = 3.1;
  275.  
  276.   unsigned int spin_speed;
  277.  
  278.   Break_Buggy();
  279.  
  280.   spin_speed = (unsigned int) (PWM_D_PERIOD * dbl_temp);
  281.  
  282.   PWM_TIM3_Set_Duty(spin_speed,  _PWM_NON_INVERTED, _PWM_CHANNEL3);  //PWM_D  right_forward
  283.  
  284.   spin_speed = (unsigned int) (PWM_B_PERIOD * dbl_temp);
  285.  
  286.   PWM_TIM4_Set_Duty(spin_speed,  _PWM_NON_INVERTED, _PWM_CHANNEL4);  //PWM_B  left_reverse
  287.  
  288.   TURN_L = ~TURN_L;
  289.  
  290.   TURN_R = ~TURN_R;
  291.  
  292. }
  293.  
  294.  
  295.  
  296. static void Test_Drive() {
  297.  
  298.   Break_Buggy();
  299.  
  300.   PWM_TIM4_Set_Duty(PWM_A_PERIOD >> 2,  _PWM_NON_INVERTED, _PWM_CHANNEL3);  //PWM_A  left_forward
  301.  
  302.   PWM_TIM3_Set_Duty(PWM_D_PERIOD >> 2,  _PWM_NON_INVERTED, _PWM_CHANNEL3);  //PWM_D  right_forward
  303.  
  304.   delay_ms(500);
  305.  
  306.   Break_Buggy();
  307.  
  308.   PWM_TIM4_Set_Duty(PWM_B_PERIOD >> 2,  _PWM_NON_INVERTED, _PWM_CHANNEL4);  //PWM_B  left_reverse
  309.  
  310.   PWM_TIM9_Set_Duty(PWM_C_PERIOD >> 2,  _PWM_NON_INVERTED, _PWM_CHANNEL1);  //PWM_C  right_reverse
  311.  
  312.   delay_ms(500);
  313.  
  314.   Break_Buggy();
  315.  
  316. }
  317.  
  318.  
  319.  
  320. static void Test_Drive_2() {
  321.  
  322.   Break_Buggy();
  323.  
  324.   PWM_TIM4_Set_Duty(PWM_A_PERIOD >> 1,  _PWM_NON_INVERTED, _PWM_CHANNEL3);  //PWM_A  left_forward
  325.  
  326.   PWM_TIM9_Set_Duty(PWM_C_PERIOD >> 1,  _PWM_NON_INVERTED, _PWM_CHANNEL1);  //PWM_C  right_reverse
  327.  
  328.   delay_ms(200);
  329.  
  330.   Break_Buggy();
  331.  
  332. }
  333.  
  334.  
  335.  
  336. static void Full_Circle_Right() {
  337.  
  338.   //double dbl_temp = (double)readBuff[6] / 100;
  339.  
  340.   double dbl_temp = 0.5;
  341.  
  342.   unsigned int spin_speed;
  343.  
  344.   Break_Buggy();
  345.  
  346.   spin_speed = (unsigned int) (PWM_A_PERIOD * dbl_temp);
  347.  
  348.   PWM_TIM4_Set_Duty(spin_speed,  _PWM_NON_INVERTED, _PWM_CHANNEL3);  //PWM_A  left_forward
  349.  
  350.   spin_speed = (unsigned int) (PWM_C_PERIOD * dbl_temp);
  351.  
  352.   PWM_TIM9_Set_Duty(spin_speed,  _PWM_NON_INVERTED, _PWM_CHANNEL1);  //PWM_C  right_reverse
  353.  
  354.   TURN_L = ~TURN_L;
  355.  
  356.   TURN_R = ~TURN_R;
  357.  
  358. }
  359.  
  360. //kretanje buggy-ja napred
  361.  
  362.  static void Forward(int times) {
  363.  
  364.   int i;
  365.  
  366.   Break_Buggy();
  367.  
  368.   PWM_TIM4_Set_Duty((unsigned int) (PWM_A_PERIOD * 0.2),  _PWM_NON_INVERTED, _PWM_CHANNEL3);
  369.  
  370.   PWM_TIM3_Set_Duty((unsigned int) (PWM_D_PERIOD * 0.2),  _PWM_NON_INVERTED, _PWM_CHANNEL3);
  371.  
  372.   //PWM_TIM4_Set_Duty(PWM_A_PERIOD >> 2,  _PWM_NON_INVERTED, _PWM_CHANNEL3);  //PWM_A  left_forward
  373.  
  374.   //PWM_TIM3_Set_Duty(PWM_D_PERIOD >> 2,  _PWM_NON_INVERTED, _PWM_CHANNEL3);  //PWM_D  right_forward
  375.  
  376.   for(i = 0; i < times; i += 1) {
  377.  
  378.  
  379.  
  380.      delay_ms(1);
  381.  
  382.   }
  383.  
  384.   Break_Buggy();
  385.  
  386. }
  387.  
  388.  
  389.  
  390. //isto kretanje buggy-ja napred
  391.  
  392. static void Forward_1() {
  393.  
  394.  
  395.  
  396.   Break_Buggy();
  397.  
  398.   PWM_TIM4_Set_Duty(PWM_A_PERIOD >> 2,  _PWM_NON_INVERTED, _PWM_CHANNEL3);  //PWM_A  left_forward
  399.  
  400.   PWM_TIM3_Set_Duty(PWM_D_PERIOD >> 2,  _PWM_NON_INVERTED, _PWM_CHANNEL3);  //PWM_D  right_forward
  401.  
  402.   delay_ms(150);
  403.  
  404.   Break_Buggy();
  405.  
  406. }
  407.  
  408.  
  409.  
  410. //kretanje buggy-ja desno
  411.  
  412. static void Right(int times) {
  413.  
  414.  
  415.  
  416.   int i;
  417.  
  418.   Break_Buggy();
  419.  
  420.     PWM_TIM9_Set_Duty((unsigned int) (PWM_C_PERIOD * 0.5),  _PWM_NON_INVERTED, _PWM_CHANNEL1);  //PWM_C  right_reverse
  421.  
  422.   PWM_TIM4_Set_Duty((unsigned int) (PWM_A_PERIOD * 0.5),  _PWM_NON_INVERTED, _PWM_CHANNEL3);  //PWM_A  left_forward
  423.  
  424.     for(i = 0; i < times; i += 1) {
  425.  
  426.  
  427.  
  428.      delay_ms(1);
  429.  
  430.   }
  431.  
  432.   Break_Buggy();
  433.  
  434. }
  435.  
  436. //kretanje buggy-ja levo
  437.  
  438. static void Left(int times) {
  439.  
  440.  
  441.  
  442.   int i;
  443.  
  444.   Break_Buggy();
  445.  
  446.   PWM_TIM4_Set_Duty((unsigned int) (PWM_B_PERIOD * 0.5),  _PWM_NON_INVERTED, _PWM_CHANNEL4);  //PWM_B  left_reverse
  447.  
  448.    PWM_TIM3_Set_Duty((unsigned int) (PWM_D_PERIOD * 0.5),  _PWM_NON_INVERTED, _PWM_CHANNEL3);  //PWM_D  right_forward
  449.  
  450.   for(i = 0; i < times; i += 1) {
  451.  
  452.  
  453.  
  454.      delay_ms(1);
  455.  
  456.   }
  457.  
  458.   Break_Buggy();
  459.  
  460. }
  461.  
  462. //kretanje buggy-ja unazad
  463.  
  464. static void Back(int times) {
  465.  
  466.  
  467.  
  468.   int i;
  469.  
  470.   Break_Buggy();
  471.  
  472.   PWM_TIM4_Set_Duty(PWM_B_PERIOD >> 2,  _PWM_NON_INVERTED, _PWM_CHANNEL4);  //PWM_B  left_reverse
  473.  
  474.   PWM_TIM9_Set_Duty(PWM_C_PERIOD >> 2,  _PWM_NON_INVERTED, _PWM_CHANNEL1);  //PWM_C  right_reverse
  475.  
  476.   for(i = 0; i < times; i += 1) {
  477.  
  478.  
  479.  
  480.      delay_ms(1);
  481.  
  482.   }
  483.  
  484.   Break_Buggy();
  485.  
  486. }
  487.  
  488. int lefttt = 0;
  489.  
  490. static void Circle_right(int times) {
  491.  
  492.   int i = 0;
  493.  
  494.   for(i; i < times; i++) {
  495.  
  496.      Right(13);
  497.  
  498.      Forward(8);
  499.  
  500.   }
  501.  
  502. }
  503.  
  504.  
  505.  
  506. static void Circle_left(int times) {
  507.  
  508.   int i = 0;
  509.  
  510.   for(i; i < times; i++) {
  511.  
  512.      Left(13);
  513.  
  514.      Forward(8);
  515.  
  516.   }
  517.  
  518. }
  519.  
  520.  
  521.  
  522. //nameĊĦtanje kako ce se kretati buggy
  523.  
  524. static void Test_Drive_3() {
  525.  
  526. Forward(50);   //napred
  527.  
  528.  
  529.  
  530. //           if(lefttt == 0) {
  531.  
  532. //                 Circle_right(8);
  533.  
  534. //           } else if(lefttt == 1) {
  535.  
  536.                    Circle_right(7);
  537.  
  538. //           }
  539.  
  540.  
  541.  
  542.            Forward(50);
  543.  
  544.            Circle_left(8);
  545.  
  546. //           Forward(30);  //naprede
  547.  
  548. //           Left(30);        //levo
  549.  
  550. //           Forcircle_right
  551.  
  552.  
  553.  
  554. }
  555.  
  556.  
  557.  
  558. int circle_right_time = 1;
  559.  
  560. int Circle_right_time1 = 50;
  561.  
  562.  
  563.  
  564. static void Circle_right1(int times) {
  565.  
  566.   int i = 0;
  567.  
  568.   for(i; i < times; i++) {
  569.  
  570.      Right(circle_right_time1);
  571.  
  572.      Forward(1);
  573.  
  574.   }
  575.  
  576. }
  577.  
  578.  
  579.  
  580. static void Test_Drive_4() {
  581.  
  582.        while(1) {
  583.  
  584. //                circle_right_time = circle_right_time + 1;
  585.  
  586. //                circle_right_time1 = circle_right_time1 - 1;
  587.  
  588. //                   Circle_right1(circle_right_time);
  589.  
  590. //                   Forward(circle_right_time);
  591.  
  592. circle_right_time1 = circle_right_time1 - 1;
  593.  
  594. if(circle_right_time1 == 0) {
  595.  
  596.  Circle_right_time1 = 50;
  597.  
  598.  }
  599.  
  600.  Right(circle_right_time1);
  601.  
  602.  Forward(1);
  603.  
  604.  
  605.  
  606.        }
  607.  
  608. }
  609.  
  610.  
  611.  
  612. //pokretanje buggy-ja
  613.  
  614. void Start_Buggy() {
  615.  
  616.   PWM_TIM4_Start(_PWM_CHANNEL3, &_GPIO_MODULE_TIM4_CH3_PB8);
  617.  
  618.   PWM_TIM4_Start(_PWM_CHANNEL4, &_GPIO_MODULE_TIM4_CH4_PB9);
  619.  
  620.   PWM_TIM9_Start(_PWM_CHANNEL1, &_GPIO_MODULE_TIM9_CH1_PE5);
  621.  
  622.   PWM_TIM3_Start(_PWM_CHANNEL3, &_GPIO_MODULE_TIM3_CH3_PB0);
  623.  
  624.  
  625.  
  626. //  HeadLamps_Blink();  //postavljanje na koliko vremena ce se lampice paliti
  627.  
  628. //  Test_Drive();             //kretanje rada lampica
  629.  
  630. //  Test_Drive_2();         // kretanje rada lampica
  631.  
  632.   Test_Drive_4();        //namestati kako ce se kretati buggy
  633.  
  634.   Break_Buggy();      //zaustaviti buggy-ja
  635.  
  636. }
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646. void Drive_Buggy() {
  647.  
  648.    double dbl_temp;
  649.  
  650.    char dir = readBuff[5];
  651.  
  652.    char vel_left = readBuff[6];
  653.  
  654.    char vel_right = readBuff[7];
  655.  
  656.  
  657.  
  658.    if (dir != 0) { //reverse direction
  659.  
  660.        //left motors
  661.  
  662.        dbl_temp = (double)vel_left / 100;                                        //Convert received speed in %
  663.  
  664.        SPEED_L = (unsigned int) (PWM_B_PERIOD * dbl_temp);
  665.  
  666.        PWM_TIM4_Set_Duty(0,  _PWM_NON_INVERTED, _PWM_CHANNEL3);                 // left forward PWM
  667.  
  668.        PWM_TIM4_Set_Duty(SPEED_L,  _PWM_NON_INVERTED, _PWM_CHANNEL4);           // left reverse PWM
  669.  
  670.        //right motors
  671.  
  672.        dbl_temp = (double)vel_right / 100;
  673.  
  674.        SPEED_R = (unsigned int) (PWM_C_PERIOD * dbl_temp);
  675.  
  676.        PWM_TIM3_Set_Duty(0,  _PWM_NON_INVERTED, _PWM_CHANNEL3);                 // right forward PWM
  677.  
  678.        PWM_TIM9_Set_Duty(SPEED_R,  _PWM_NON_INVERTED, _PWM_CHANNEL1);           // right_reverse PWM
  679.  
  680.    }else{ //forward direction
  681.  
  682.        //left motors
  683.  
  684.        dbl_temp = (double)vel_left / 100;                                        //Convert received speed in %
  685.  
  686.        SPEED_L = (unsigned int) (PWM_A_PERIOD * dbl_temp);
  687.  
  688.        PWM_TIM4_Set_Duty(0,  _PWM_NON_INVERTED, _PWM_CHANNEL4);                 // left reverse  PWM
  689.  
  690.        PWM_TIM4_Set_Duty(SPEED_L,  _PWM_NON_INVERTED, _PWM_CHANNEL3);           // left forward  PWM
  691.  
  692.        //right motors
  693.  
  694.        dbl_temp = (double)vel_right / 100;
  695.  
  696.        SPEED_R = (unsigned int) (PWM_D_PERIOD * dbl_temp);
  697.  
  698.        PWM_TIM9_Set_Duty(0,  _PWM_NON_INVERTED, _PWM_CHANNEL1);                 // right reverse PWM
  699.  
  700.        PWM_TIM3_Set_Duty(SPEED_R,  _PWM_NON_INVERTED, _PWM_CHANNEL3);           // right forward PWM
  701.  
  702.    }
  703.  
  704. }
  705.  
  706.  
  707.  
  708. static void SetBattValueToBuffer(unsigned int Value){
  709.  
  710.   //Divide to 4x4bit value
  711.  
  712.   writeBuff[0] = (char)((Value >> 12)& 0xF); //HHHsb
  713.  
  714.   writeBuff[1] = (char)((Value >> 8)& 0xF);  //HHsb
  715.  
  716.   writeBuff[2] = (char)((Value >> 4) & 0xF); //Hsb
  717.  
  718.   writeBuff[3] = (char)(Value & 0xF);        //Lsb
  719.  
  720. }
  721.  
  722.  
  723.  
  724.  
  725.  
  726. /*void OnDataReceived() {
  727.  
  728.  
  729.  
  730.  
  731.  
  732.   char next_cmd = readBuff[4];
  733.  
  734.   switch (next_cmd) {
  735.  
  736.     case CMD_DRIVE:
  737.  
  738.       Drive_Buggy();
  739.  
  740.       break;
  741.  
  742.     case CMD_BREAK:
  743.  
  744.       Break_Buggy();
  745.  
  746.       break;
  747.  
  748.     case CMD_SPIN:
  749.  
  750.       if (old_cmd != CMD_SPIN) {
  751.  
  752.           TURN_L = 0;
  753.  
  754.           TURN_R = 0;
  755.  
  756.       }
  757.  
  758.  
  759.  
  760.       if (readBuff[5] != 0) {
  761.  
  762.          Full_Circle_Left();
  763.  
  764.       }else{
  765.  
  766.          Full_Circle_Right();
  767.  
  768.       }
  769.  
  770.       break;
  771.  
  772.     case CMD_RESPOND:
  773.  
  774.       asm nop;
  775.  
  776.       break;
  777.  
  778.     default:
  779.  
  780.       Break_Buggy();
  781.  
  782.   }
  783.  
  784.  
  785.  
  786.   //lights control
  787.  
  788.  
  789.  
  790.   BREAK_LAMPS = readBuff[8] & 0x01;
  791.  
  792.   MAIN_BEAM = readBuff[8] >> 3;
  793.  
  794.   HEAD_LAMPS = readBuff[8] >> 4;
  795.  
  796.   if (next_cmd != CMD_SPIN) {
  797.  
  798.     if (readBuff[8] & 0x02) {
  799.  
  800.       TURN_L = ~TURN_L;
  801.  
  802.     }else{
  803.  
  804.       TURN_L = 0;
  805.  
  806.     }
  807.  
  808.  
  809.  
  810.     if (readBuff[8] & 0x04) {
  811.  
  812.       TURN_R = ~TURN_R;
  813.  
  814.     }else{
  815.  
  816.       TURN_R = 0;
  817.  
  818.     }
  819.  
  820.  
  821.  
  822.   }
  823.  
  824.  
  825.  
  826.   //turn off turn lights after spining
  827.  
  828.   if (next_cmd != old_cmd) {
  829.  
  830.     if (old_cmd == CMD_SPIN) {
  831.  
  832.       TURN_L = 0;
  833.  
  834.       TURN_R = 0;
  835.  
  836.     }
  837.  
  838.   }
  839.  
  840.  
  841.  
  842.   old_cmd = next_cmd;
  843.  
  844.   txPipe = readBuff[2] + 1;
  845.  
  846.   temp_int = ADC1_Get_Sample(13);
  847.  
  848.   SetBattValueToBuffer(temp_int);
  849.  
  850.   Blep_SendData(&writeBuff,6,TxPipe);
  851.  
  852.  
  853.  
  854. }  */
  855.  
  856.  
  857.  
  858. void main()
  859.  
  860. {
  861.  
  862.      Init_Buggy();              //podesavanje buggy-ja
  863.  
  864.      while(1){
  865.  
  866. //  Break_Buggy();           //zaustaviti buggy-ja
  867.  
  868. //  HEAD_LAMPS = 1;    //lampice
  869.  
  870. //  MAIN_BEAM = 1;
  871.  
  872. //  PWM_TIM4_Set_Duty(PWM_A_PERIOD >> 2,  _PWM_NON_INVERTED, _PWM_CHANNEL3);  //PWM_A  left_forward
  873.  
  874. //  PWM_TIM3_Set_Duty(PWM_D_PERIOD >> 2,  _PWM_NON_INVERTED, _PWM_CHANNEL3);  //PWM_D  right_forward
  875.  
  876. //  delay_ms(250);
  877.  
  878. //  HEAD_LAMPS = 0;      //lampice
  879.  
  880. //  MAIN_BEAM = 0;
  881.  
  882. //  Break_Buggy();           //zaustaviti buggy-ja
  883.  
  884. //  BREAK_LAMPS = 1;  //zaustaviti paljenje lapmica
  885.  
  886. //  MAIN_BEAM = 1;
  887.  
  888. //  PWM_TIM4_Set_Duty(PWM_B_PERIOD >> 2,  _PWM_NON_INVERTED, _PWM_CHANNEL4);  //PWM_B  left_reverse
  889.  
  890. //  PWM_TIM9_Set_Duty(PWM_C_PERIOD >> 2,  _PWM_NON_INVERTED, _PWM_CHANNEL1);  //PWM_C  right_reverse
  891.  
  892. //  delay_ms(250);
  893.  
  894. //  BREAK_LAMPS = 0;    //zaustaviti paljenje lampica
  895.  
  896. //  MAIN_BEAM = 0;
  897.  
  898. //  Break_Buggy();            //zaustaviti buggy-ja
  899.  
  900. //  TurnLamps_Blink_R();  //red poaljenja desnih lampica
  901.  
  902. //  PWM_TIM4_Set_Duty(PWM_A_PERIOD >> 1,  _PWM_NON_INVERTED, _PWM_CHANNEL3);  //PWM_A  left_forward
  903.  
  904. //  PWM_TIM9_Set_Duty(PWM_C_PERIOD >> 1,  _PWM_NON_INVERTED, _PWM_CHANNEL1);  //PWM_C  right_reverse
  905.  
  906. //  delay_ms(150);
  907.  
  908. //  Break_Buggy();          //zaustaviti buggy-ja
  909.  
  910. //  Start_Buggy();           //pokretanje buggy-ja
  911.  
  912. //Test_Drive_3();
  913.  
  914.                  Start_Buggy();
  915.  
  916.      }
  917.  
  918. }
  919. txt.txt
  920. Open with Google Docs
  921. Displaying txt.txt.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top