Show Posts
Pages: 1 2 [3] 4 5 ... 650
31  Using Arduino / Programming Questions / Re: Two Buttons one led on/off on: September 26, 2014, 05:30:27 pm
Momentary button switch code for servos, but might be modified to work for the LEDs.

Code:
//zoomkat servo button test 12-29-2011
// Powering a servo from the arduino usually *DOES NOT WORK*.

#include <Servo.h>
int button1 = 4; //button pin, connect to ground to move servo
int press1 = 0;
int button2 = 5; //button pin, connect to ground to move servo
int press2 = 0;
Servo servo1;

void setup()
{
  pinMode(button1, INPUT);
  pinMode(button2, INPUT);
  servo1.attach(7);
  digitalWrite(4, HIGH); //enable pullups to make pin high
  digitalWrite(5, HIGH); //enable pullups to make pin high
}

void loop()
{
  press1 = digitalRead(button1);
  if (press1 == LOW)
  {
    servo1.write(170);
  }   
 
  press2 = digitalRead(button2);
  if (press2 == LOW)
  {
    servo1.write(10);
  }
}


32  Using Arduino / Programming Questions / Re: Controlling 3 servo motors using push buttons on: September 26, 2014, 05:20:28 pm
Some simple two button servo test code.

Code:
//zoomkat servo button test 12-29-2011
// Powering a servo from the arduino usually *DOES NOT WORK*.

#include <Servo.h>
int button1 = 4; //button pin, connect to ground to move servo
int press1 = 0;
int button2 = 5; //button pin, connect to ground to move servo
int press2 = 0;
Servo servo1;

void setup()
{
  pinMode(button1, INPUT);
  pinMode(button2, INPUT);
  servo1.attach(7);
  digitalWrite(4, HIGH); //enable pullups to make pin high
  digitalWrite(5, HIGH); //enable pullups to make pin high
}

void loop()
{
  press1 = digitalRead(button1);
  if (press1 == LOW)
  {
    servo1.write(170);
  }   
 
  press2 = digitalRead(button2);
  if (press2 == LOW)
  {
    servo1.write(10);
  }
}

33  Topics / Home Automation and Networked Objects / Re: Need help with my Arduino controlled Linear Actuator on: September 25, 2014, 05:59:58 pm
Quote
Is there other way of controlling the actuator?

Below is a method to operate the linear actuator with relays. The actuator should already have the internal limit switches.

34  Using Arduino / General Electronics / Re: cheap, easy way to connect 20+ arduino on: September 24, 2014, 10:56:17 pm
if your setup is a master arduino and a lot of slave arduinos, then you probably could use four wires for tx, rx, ground and power between them. You might need diodes on the slave tx pins in such a setup.
35  Using Arduino / Project Guidance / Re: Wireless baby monitor using Arduinos? on: September 24, 2014, 10:41:46 pm
Natures warning sign: if this baby monitor concept is actually practical/possible you would already seeing it widely used in various robotic setups.
36  Using Arduino / Project Guidance / Re: Robotic car for security surveillance. on: September 24, 2014, 10:34:06 pm
Ideas on a somewhat similar project. Note that a wireless router is used for the wifi connection.

http://www.lynxmotion.net/viewtopic.php?f=20&t=6343
37  Using Arduino / Programming Questions / Re: Move servos independent by pressing joystick button on: September 24, 2014, 10:29:51 pm
Quote
Below is my code, it doesnt allow the select button to do anything, i.e the two servos move simultaneously when i move the joystick

You might try making the servo commands a variable that is sent to the servo in the main loop. Make an if statement in the main loop that updates the servo command variable if the button is pushed. The variable update is skipped when the button is not pressed.
38  Using Arduino / Programming Questions / Re: Can't control AX-12 servo position with Smart Servo Shield on: September 24, 2014, 09:11:53 pm
Do the Ax-12 servos use the conventional servo control commands?
39  Using Arduino / Programming Questions / Re: Serial ASCII on: September 24, 2014, 08:44:24 pm
If your issue is inverting the TTL output to rs232, you should be able to make a simple inverter with  resistors and an NPN transistor to allow the use of the normal serial library.

http://www.scienceprog.com/alternatives-of-max232-in-low-budget-projects/
40  Using Arduino / Motors, Mechanics, and Power / Re: 120 degree precisely (hence no 1.8 +/-5%) on: September 24, 2014, 08:16:55 pm
You might get a stepper motor/driver setup like below and experiment. The motor probably has four discrete positions per rotation, and it has 64-1 gear reduction, so that should resolve to 256 discrete positions in one rotation of the output shaft. That would give 1.4 deg position accuracy.

http://www.ebay.com/itm/5V-Stepper-Step-Motor-Driver-Board-ULN2003-28BYJ-48-For-Arduino-High-Quality-/271473069262?pt=LH_DefaultDomain_2&hash=item3f350e4cce
41  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet Shield web client on: September 24, 2014, 07:19:35 pm
There are various ways to collect data from web pages. you might look at the TextFinder info below. If the page source isn't large, you might capture the whole page and extract the data. I've counted carriage returns to locate the desired data and then captured the desired lines for data extraction.

http://playground.arduino.cc/Code/TextFinder
42  Using Arduino / Programming Questions / Re: Move Servo to (pos)X via ButtonPush then back to (pos)Y after Timer ends? on: September 23, 2014, 08:37:45 pm
Quote
//What I am trying to accomplish is this.
-------------------------------------------------------------------------------------
Push a button and have that cause a servo to move to a new position.
THEN
After a period of time has passed have the servo move back to the original position.
-------------------------------------------------------------------------------------


Code:
//zoomkat servo button test 7-30-2011

#include <Servo.h>
int button1 = 4; //button pin, connect to ground to move servo
int press1 = 0;
Servo servo1;

void setup()
{
  pinMode(button1, INPUT);
  servo1.attach(7);
  digitalWrite(4, HIGH); //enable pullups to make pin high
}

void loop()
{
  press1 = digitalRead(button1);
  if (press1 == LOW)
  {
    servo1.write(160);
    delay(2000);
    servo1.write(20);
  }
}

43  Using Arduino / Programming Questions / Re: Twitter Json parse on: September 23, 2014, 08:30:50 pm
Possible reading material.

https://www.google.com/search?as_q=temboo+twitter&as_epq=&as_oq=&as_eq=&as_nlo=&as_nhi=&lr=&cr=&as_qdr=all&as_sitesearch=http%3A%2F%2Fforum.arduino.cc%2Findex&as_occt=any&safe=images&tbs=&as_filetype=&as_rights=&gws_rd=ssl
44  Using Arduino / Programming Questions / Re: Serial ASCII on: September 23, 2014, 08:18:58 pm
You might try the below to see if it works.

Code:
Serial.write (1) ;
 Serial.write (112) ;
 Serial.write (43) ;
  Serial.print ("01") ;
  Serial.write (3) ;
45  Using Arduino / Programming Questions / Re: Problem with comparing Strings from Serial on: September 23, 2014, 08:01:36 pm
Some simple serial String comparison code.

Code:
// zoomkat 8-6-10 serial I/O string test
// type a string in serial monitor. then send or enter
// for IDE 0019 and later

int ledPin = 13;
String readString;

void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  Serial.println("serial on/off test 0021"); // so I can keep track
}

void loop() {

  while (Serial.available()) {
    delay(3); 
    char c = Serial.read();
    readString += c;
  }

  if (readString.length() >0) {
    Serial.println(readString);

    if (readString == "on")     
    {
      digitalWrite(ledPin, HIGH);
    }
    if (readString == "off")
    {
      digitalWrite(ledPin, LOW);
    }

    readString="";
  }
}
Pages: 1 2 [3] 4 5 ... 650