1. Список говнокодов пользователя Jonathan_Rosewood

    Всего: 2

  2. Java / Говнокод #19281

    −34

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    /*
    arduino_output
    
    Controlls arduino via Firmdata protocol
    */
    
    import processing.serial.*;
    
    import cc.arduino.*;
    
    Arduino arduino;
    
    PFont font;
    color off = color(4, 79, 111);
    color on = color(84, 145, 158);
    
    int[] modes = { Arduino.OUTPUT, Arduino.OUTPUT, Arduino.OUTPUT, Arduino.OUTPUT,
     Arduino.OUTPUT, Arduino.OUTPUT, Arduino.OUTPUT, Arduino.OUTPUT, Arduino.OUTPUT,
     Arduino.OUTPUT, Arduino.OUTPUT, Arduino.OUTPUT, Arduino.OUTPUT, Arduino.OUTPUT };
    
    int[] values = { Arduino.LOW, Arduino.LOW, Arduino.LOW, Arduino.LOW,
     Arduino.LOW, Arduino.LOW, Arduino.LOW, Arduino.LOW, Arduino.LOW,
     Arduino.LOW, Arduino.LOW, Arduino.LOW, Arduino.LOW, Arduino.LOW };
    
    int[] pwms = { 100,100,100,100, 100,100,100,100,100, 100,100,100,100,100 };
    
    void setup() {
      size(470, 340);
      font = createFont("Arial", 16, true);
      
      // Prints out the available serial ports.
      //println(Arduino.list());
      
      // Modify this line, by changing the "0" to the index of the serial
      // port corresponding to your Arduino board (as it appears in the list
      // printed by the line above).
      arduino = new Arduino(this, Arduino.list()[2], 57600);
      
      // Alternatively, use the name of the serial port corresponding to your
      // Arduino (in double-quotes), as in the following line.
      //arduino = new Arduino(this, "/dev/tty.usbmodem621", 57600);
      
      // Set the Arduino digital pins as outputs.
      for (int i = 0; i <= 13; i++)
        arduino.pinMode(i, modes[i]);
    }
    
    void draw() {
      background(off);
      stroke(on);
    
      // Titles & Authors
      textAlign(LEFT);
      text("Arduino GUI Controller v0.1", 5, 335);
      textAlign(RIGHT);
      text("by Jonathan Rosewood", 465, 335);
    
      // Buttons
      noFill();
      textAlign(CENTER);
      rect(360, 90, 80, 30);
      text("DEFAULT", 400, 110);
      rect(360, 130, 80, 30);
      text("REBOOT", 400, 150);
      
      // Digital pins
      for (int i = 0; i <= 13; i++) {
        // Draw lables
        fill(on);
        textAlign(CENTER);
        text(str(i), 430 - i * 30, 20);
        
        // Draw pins
        if (modes[i] == Arduino.OUTPUT) {
          if (values[i] == Arduino.HIGH)
            fill(on);
          else
            fill(off);
        } else {
          if (arduino.digitalRead(i) == Arduino.HIGH)
            fill(on);
          else
            fill(off);
        }
        rect(420 - i * 30, 30, 20, 20);
        
        // Draw modes
        fill(on);
        textAlign(CENTER);
        if (modes[i] == Arduino.OUTPUT)
          text("O", 431 - i * 30, 75);
        else
          text("I", 431 - i * 30, 75);
        noFill();
        rect(420 - i * 30, 60, 20, 20);
        
        // Draw PWM bars
        noFill();
        if(i == 3 || i == 5 || i == 6 || i == 9 || i == 10 || i == 11) {
          rect(420 - i * 30, 90, 20, 100);

    Пацан дебаг панельку на ардуинку писал.

    Jonathan_Rosewood, 09 Января 2016

    Комментарии (8)
  3. Куча / Говнокод #16211

    +127

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    // Step 2
     	inline CreateCharacterDialogStep2(playerid, dialogid, response, listitem, string:inputtext[]) {
     		#pragma unused dialogid, listitem, inputtext
     		if(!response) return CreateCharacter(playerid);
     		if(strlen(inputtext) < MIN_PLAYER_CHARACTER_NAME || strlen(inputtext) > MAX_PLAYER_NAME) return CreateCharacter(playerid);
    
    -		if(!IsRolePlayNickname(inputtext)) return CreateCharacter(playerid);
    -		SetPVarString(playerid, "name", inputtext);
    +		if(!IsRolePlayNickname(str_replace(" ", "_", inputtext))) return CreateCharacter(playerid);
    +		SetPVarString(playerid, "name", str_replace(" ", "_", inputtext));
     
     		format(title, sizeof(title), "Character creating - Step 3: Sex");
     		format(content, sizeof(content), "\
     			Skip\r\n\%s\r\n\%s\
     		", Group_GetName(gMale), Group_GetName(gFemale));
     		Dialog_ShowCallback(playerid, using inline CreateCharacterDialogStep3, DIALOG_STYLE_LIST, title, content, "Next", "Back");
     		return false;
     	}

    Отличное изменение.

    Jonathan_Rosewood, 23 Июня 2014

    Комментарии (0)