Loading...
Logo
Processing Forum
johnnyjack777's Profile
8 Posts
17 Responses
0 Followers

Activity Trend

Last 30 days
Show:
Private Message
    Hey, as usual, sure I've mucked up something simple...


    abridged version:
    1. int[] CurrentArray = new int[6];
    2. port.write (CurrentArray[0]);port.write (CurrentArray[1]);port.write (CurrentArray[2]);port.write (CurrentArray[3]);port.write (CurrentArray[4]);port.write (CurrentArray[5]); //Finally send the current array to the arm
    if I omit Array 0, the other 5 channels work fine... but when I send all 6, it jitters like crazy...

    (if Array 0 is made identical to Array 1, it still fails, even though A1 worked fine without A0 enabled)





    The Related Arduino code is literally as simple as possible, so I don't think it's there :(
    1. while (Serial.available()<5) {} // Wait 'till there are 6 Bytes waiting
      for(int n=0; n<5; n++)    //  is 5 or 6?
         CurrentArray[n] = Serial.read(); // Then: Get them.

      gripper.write(CurrentArray[5]); wrist.write(CurrentArray[4]);wristRotate.write(CurrentArray[3]);
      elbow.write(CurrentArray[2]);shoulder.write(CurrentArray[1]);shoulderRotate.write(CurrentArray[0]);


    Any thoughts
          (productive thoughts?) :p
    text(String123, 0,600);


    This doesn't work :( was hoping I didn't have to counter it out like an array



    text(c, x, y) 
    text(c, x, y, z)
    text(str, x, y)
    text(chars, start, stop, x, y)
    text(
    str, x, y, z)
    text(chars, start, stop, x, y, z)
    text(str, x1, y1, x2, y2)
    text(num, x, y)
    text(num, x, y, z)
    Doesn't this^ imply I can do just That? :(

    thanks for listening!
    -J
    Hey... basic concept but I somehow missed it...


    How do I repeat a line of code forever until something happens?

    1.  case('q'):port.write("w"+0); port.write("w"+180); GOTO case('q') ; break;
    Something like that is what I want.... actually I wouldn't even need to 'break' the statement then
    stupid question...

    any reason propellor wouldn't be as easy to use with processing as arduino?

    I mean the programs I wrote that send serial commands.... "w 120" is still "w 120" right?


    ("processing" and "Anything" in google never returns stuff related to the processing Language :)

    Thanks!
    -J
    This is the problem section, it thinks "unexpected token: {" when there's no brackets out of place :( I've gone over it like 20 times


    char lastChar = entered.charAt(entered.length()-1 ); 

      if (lastChar == '?') {         
         lastChar = entered.charAt(entered.length()-3);

                                 } 
      if (lastChar == ('a', 'b', 'c', 'd') {         // WHYTHEFUCK CAN'T I USE MULTIPLE LETTERS?!?!
           fill(0,255,0);  text("YES", 300, 200);

                                                }
       else {
           text("NO", 300, 200);
             }

          //       }   this is the only off bracket, for the  void draw

    *********************************************************************************************************

      if (lastChar == ('a', 'b', 'c', 'd')      //This doesn't work... anyone know the right way?




    Entire Code below, thanks for your time either way. (God it's messy in this format)
    ********************************************************************************************************


    PFont z;
    String USERINPUT="    ";
    String entered = "    ";



    void setup() {
       size(1000,500);

       z = createFont("Arial",20,true);
    }
     
     void draw() {
      background(0);
       stroke(255); //Outline color
         textFont(z, 30);         //and color it
         fill(255);
      int x = 75;               //First char is at 75
      text("Simple AI protocol, ask a yes or no question (Type and press enter)", 30, 30);
        text(USERINPUT,50,90);
      text(entered,200,130);


    char lastChar = entered.charAt(entered.length()-1 );  //lastChar = last charachter entered, returns: StringIndexOutOfBoundsException: String index out of range: whatever number the string is long// 

      if (lastChar == '?') {          //if it's a ? then go to the second to last char //CANNOT CONVERT FROM CHAR TO BOOLEAN //once == is made, incompatible operand types char and string, // meaning it needs to be single quotes 'a' NOT "a"
         lastChar = entered.charAt(entered.length()-3);  //remember, it starts counting at 0, so -1 is the last, -2 is secondToLast (-3 to skip the shift keypress

                           } 
      if (lastChar == ('a') {         //, WHYTHEFUCK CAN'T I USE MULTIPLE LETTERS?!?!
           fill(0,255,0);  text("YES", 300, 200);
    //    if (lastChar == ('')  {return:}It should not start with No on the screen
                            }
       else {
           text("NO", 300, 200);
            }

                 }   //and when it decides there's an "Unexpected token: { bracket for no reason....


    void keyPressed() {
      if (key == '\n' ) {    // If the return key is pressed, save the String and clear it \n = newline
        entered = USERINPUT; // A String can be cleared by setting it equal to ""
        USERINPUT = "";
      } else {
        // Otherwise, concatenate the String
        // Each character typed by the user is added to the end of the String variable.
        USERINPUT = USERINPUT + key;
      }
    }


    Full code_ (It's short)


    final static int NORTH = 1;
    final static int EAST = 2;
    final static int SOUTH = 4;
    final static int WEST = 8;
    int result;
    float x,y;
     
    void setup() {
      size(512,400);
      frameRate(30); 
      result = 0;
      x = width/2;
      y = height/2;
    }
     
    void draw() {
      background(0);
      switch(result) {
        case NORTH: y--; break;
        case EAST: x++; break;
        case SOUTH: y++; break;
        case WEST: x--; break;
        case NORTH|EAST: y--; x++; break;
        case NORTH|WEST: y--; x--; break;
        case SOUTH|EAST: y++; x++; break;
        case SOUTH|WEST: y++; x--; break;
      }
      fill(255);
      rect(x,y,10,10);
    }
     
    void keyPressed(){
      switch(key) {
        case('w'):case('W'):result |=NORTH;break;
        case('d'):case('D'):result |=EAST;break;
        case('s'):case('S'):result |=SOUTH;break;
        case('a'):case('A'):result |=WEST;break;
      }
    }
     
    void keyReleased(){ 
      switch(key) {
        case('w'):case('W'):result ^=NORTH;break;
        case('d'):case('D'):result ^=EAST;break;
        case('s'):case('S'):result ^=SOUTH;break;
        case('a'):case('A'):result ^=WEST;break;
      }
    }


    PLEASE, NOWHERE does that pipe "|" or whatever this is "^" show up in ANY resource I have ;(
    also if anyone understands what this code is doing please, it was uncommented :p
    Hello,

    Is there any way to take the capture stream from an IP address or website? (Same thing rite?)



    Was trying to rig a wifi webcam to to image processing on a computer, then radio the info back to a robot.

    The problem is I can't find good documentation on HOW the capture function works,
    Wifi webcams will present to the Router only, as an IP address,

    Not as a serial/COM line in from USB (Which is how most of the other processing peripherals get in)

    (haven't bought the webcam yet)

    Thanks,
    -Graves