Page 6 of 23 FirstFirst 123456789101116 ... LastLast
Results 51 to 60 of 225

Thread: Project: Tempest SXR

  1. #51
    Overclocked StormRider's Avatar
    Join Date
    Apr 2010
    Location
    Carlsbad, CA
    Posts
    315

    Default Re: Project: Tempest SXR

    niec eye. now you can scare away burglars

  2. #52
    If you can't hack it, you don't own it! Oneslowz28's Avatar
    Join Date
    Mar 2007
    Location
    Aiken, Sc
    Posts
    5,084

    Default Re: Project: Tempest SXR

    The Arduino will only run one loop but what you can do is have it poll the temp and adjust the fins and once its finished it can scan the room. Just set a delay of like 100 between the 2 and it should work. Let me see if I can work up a code real quick.

  3. #53
    If you can't hack it, you don't own it! Oneslowz28's Avatar
    Join Date
    Mar 2007
    Location
    Aiken, Sc
    Posts
    5,084

    Default Re: Project: Tempest SXR

    You could do something like this with servo #2 being the one the eye is attached to.

    Code:
    // Controlling a servo position using a temperature sensor 
    // by Michal Rinott <http://people.interaction-ivrea.it/m.rinott> 
    // edited 5-12-2010 by Will Lyon to include base setting for servo if voltage not detected on pin 7
    //edited 6-2-2010 by Charles Gantt to include second servo scanning control
    
    #include <Servo.h> 
    #define CONTROL 7
    
    Servo myservo;  // create servo object to control a servo
    Servo servo2;   // creates servo object number 2
     
    int temps = 0;  // analog pin used to connect the temp sensor
    int val;        // variable to read the value from the analog pin
    int pos = 0;    // variable to store the servo position
     
    void setup() 
    { 
      pinMode (CONTROL, INPUT);       // sets the control pin to input
      myservo.attach(9);              // attaches the servo on pin 9 to the servo object
      servo2.attach(11);              // attaches servo #2 on pin 11 to the servo object
    
      digitalWrite(CONTROL, LOW);     // ensure internal pullup resistor is disabled.
    
    } 
     
    void loop()   
    {
      val = digitalRead(CONTROL);         //read input of pin 7 and store it
      if (val == HIGH){                   // reads whether or not 5v is present on pin 7, if 5v present, continue:
      val = analogRead(temps);            // reads the value of the temp sensor (value between 0 and 1023) 
      val = map(val, 350, 700, 75, 105);  // scale it to use it with the servo (value between 0 and 180) 
      myservo.write(val);                 // sets the servo position according to the scaled value 
      delay(25);                          // waits for the servo to get there 
    } else {
      if (val == LOW);                    // if no voltage present on pin 7, continue
      myservo.write(50);                  //sets servo position to 50 if no voltage is detected on pin 7
    }
    delay(25);        // waits for the servo to get there
    { 
    delay(100);      //delay between functions
      for(pos = 0; pos < 180; pos += 1);  // goes from 0 degrees to 180 degrees 
      {                                  // in steps of 1 degree 
        servo2.write(pos);              // tell servo to go to position in variable 'pos' 
        delay(15);                       // waits 15ms for the servo to reach the position 
      } 
      for(pos = 180; pos>=1; pos-=1);     // goes from 180 degrees to 0 degrees 
      {                                
        servo2.write(pos);              // tell servo to go to position in variable 'pos' 
        delay(15);                       // waits 15ms for the servo to reach the position 
      }
    }
    }
    Last edited by Oneslowz28; 07-02-2010 at 07:54 AM.

  4. #54
    Resident 100HP water-cannon operator SXRguyinMA's Avatar
    Join Date
    Jun 2008
    Location
    MA
    Posts
    5,865

    Default Re: Project: Tempest SXR

    I'll have to hook up a second servo and try that out. should be neat thanks! +rep

    :edit: gotta spread some rep first lol

  5. #55
    If you can't hack it, you don't own it! Oneslowz28's Avatar
    Join Date
    Mar 2007
    Location
    Aiken, Sc
    Posts
    5,084

    Default Re: Project: Tempest SXR

    I just edited the code.

  6. #56
    Resident 100HP water-cannon operator SXRguyinMA's Avatar
    Join Date
    Jun 2008
    Location
    MA
    Posts
    5,865

    Default Re: Project: Tempest SXR

    I'll have to mess around with that tonight! still hoping I hear from the waterjet guy today so I can get some work done this weekend!





    Oneslowz28 Edit: I hit the edit button instead of the quote button.
    Last edited by Oneslowz28; 07-02-2010 at 11:12 AM.

  7. #57
    If you can't hack it, you don't own it! Oneslowz28's Avatar
    Join Date
    Mar 2007
    Location
    Aiken, Sc
    Posts
    5,084

    Default Re: Project: Tempest SXR

    I will be on MSN all night so hit me up if you want to talk geek while you dev.

  8. #58
    Resident 100HP water-cannon operator SXRguyinMA's Avatar
    Join Date
    Jun 2008
    Location
    MA
    Posts
    5,865

    Default Re: Project: Tempest SXR

    msn chat? I don't have it but I can install it on my temporary (read components resting on top of a carboard box) basement comp

  9. #59
    Resident 100HP water-cannon operator SXRguyinMA's Avatar
    Join Date
    Jun 2008
    Location
    MA
    Posts
    5,865

    Default Re: Project: Tempest SXR

    I just got off the phone with Tom over @ HydroCutter and he said he's still doing the production run he had before me, and the machine had developed a leak that he had to fix, so he's hoping to have my parts done for Tuesday-ish (fingers crossed)
    Last edited by SXRguyinMA; 07-02-2010 at 04:55 PM. Reason: spelling

  10. #60
    If you can't hack it, you don't own it! Oneslowz28's Avatar
    Join Date
    Mar 2007
    Location
    Aiken, Sc
    Posts
    5,084

    Default Re: Project: Tempest SXR

    That sucks but at least you can have fun deving with arduino.

    My MSN is charlesgantt at live dot com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •