Show Posts
Pages: 1 2 [3] 4 5 ... 642
31  Using Arduino / Programming Questions / Re: Galileo: my servo runs only in one direction, it doesn't turn back on: August 30, 2014, 12:24:10 pm
Quote
I have an Intel Galileo (1st gen)

Does arduino code run on this board?
32  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Shield and Board Basic Webserver test not working on: August 29, 2014, 10:40:47 pm
Client test code you can try to see if you get a response from the server.

edit: possible more info

http://forum.arduino.cc/index.php?PHPSESSID=u1ovdcevbk9j1gpkq5sma6upn3&topic=102312.msg767487#msg767487

https://www.google.com/search?as_q=w5200&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

Code:
//zoomkat 9-22-12
//simple client test
//for use with IDE 1.0.1
//with DNS, DHCP, and Host
//open serial monitor and send an e to test
//for use with W5100 based ethernet shields
//remove SD card if inserted

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address

char serverName[] = "web.comporium.net"; // zoomkat's test web page server
EthernetClient client;

//////////////////////

void setup(){

  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }

  Serial.begin(9600);
  Serial.println("Better client test 9/22/12"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test
}

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
  {
    byte inChar; // sets inChar as a byte
    inChar = Serial.read(); //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
    {
      sendGET(); // call sendGET function below when byte is an e
    }
  }  
}

//////////////////////////

void sendGET() //client function to send/receive GET request data.
{
  if (client.connect(serverName, 80)) {  //starts client connection, checks for connection
    Serial.println("connected");
    client.println("GET /~shb/arduino.txt HTTP/1.1"); //download text
    client.println("Host: web.comporium.net");
    client.println("Connection: close");  //close 1.1 persistent connection  
    client.println(); //end of get request
  }
  else {
    Serial.println("connection failed"); //error message if no client connect
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor
  }

  Serial.println();
  Serial.println("disconnecting.");
  Serial.println("==================");
  Serial.println();
  client.stop(); //stop client

}

33  Using Arduino / Programming Questions / Re: Help on: August 29, 2014, 05:59:08 pm
Quote
My goal is to make the servo move, then stop. After the servo finishes moving, the LED will blink. Can someone help me accomplish this goal? Thanks.

To do just what you say, just put the servo movement command in the blink code setup section. I suspect you actually want to do more.
34  Using Arduino / General Electronics / Re: Motorized rotary switch on: August 29, 2014, 02:30:15 pm
Quote
I've made motorized rotary switches like below using servos.

This would work easier with servos if the "Detent" spring was made weak so the rotary force (AKA Torque) needed would be less. Or the small ball bearing in most detent mechanisms can be removed.

Below is the whole story from ~10 years ago. I think hobby king now carries a sail winch that makes ~1 turn, which would make it ideal for turning pots, switches, and 360 rotation for sensors and such.

http://web.comporium.net/~shb/switch.htm
35  Using Arduino / Programming Questions / Re: Help on: August 29, 2014, 01:03:28 pm
What part of " There is NO FEEDBACK from the servo !" did you not undrrstand ?

Have you tried decaf?
36  Using Arduino / General Electronics / Re: Motorized rotary switch on: August 29, 2014, 12:04:23 pm
I've made motorized rotary switches like below using servos.

37  Using Arduino / Motors, Mechanics, and Power / Re: Two servos on one Arduino Uno - telling time on: August 29, 2014, 11:06:35 am
Quote
have the code (below)

You need to read #7 below.

http://forum.arduino.cc/index.php/topic,148850.0.html
38  Using Arduino / Networking, Protocols, and Devices / Re: Serial Between Arduino And Picaxe on: August 29, 2014, 10:48:54 am
May be an issue with your arduino code you did not post
39  Topics / Robotics / Re: Control robotic arm using arduino and kinect on: August 29, 2014, 10:32:13 am
There is serial port monitoring software available that will run on the pc and capture the transactions occurring on the serial port. In the past i used a program called portmon to monitor serial communications.

https://www.google.com/search?as_q=serial+port+monitor&as_epq=&as_oq=&as_eq=&as_nlo=&as_nhi=&lr=&cr=&as_qdr=all&as_sitesearch=&as_occt=any&safe=images&tbs=&as_filetype=&as_rights=&gws_rd=ssl
40  Community / Exhibition / Gallery / Re: meArm: Pocket Sized Robot Arm on: August 28, 2014, 11:28:59 pm
Looks like a full size printable ,pdf parts layout/plans was posted on 8/20.

http://www.thingiverse.com/thing:360108/#files
41  Using Arduino / Project Guidance / Re: single wire hardware uart on: August 28, 2014, 11:12:13 pm
Quote
how to avoid this in hardware level or software level?

You could put a unique character in the data being sent to identify the sender, which would allow the detection and discarding of self generated data packets.
42  Using Arduino / Project Guidance / Re: Servo or motors not working when using pins 9,10,11 on: August 28, 2014, 10:23:46 pm
Servo test code that includes the attach/detach functions you can try with various pins..

Code:
// zoomkat 12-25-13 serial servo test
// type servo position 0 to 180 in serial monitor
// or for writeMicroseconds, use a value like 1500
// Send an a to attach servo or d to detach servo
// for IDE 1.0.5 and later
// Powering a servo from the arduino usually *DOES NOT WORK*.

#include <Servo.h>
String readString; //String captured from serial port
Servo myservo;  // create servo object to control a servo
int n; //value to write to servo

void setup() {
  Serial.begin(9600);
  myservo.writeMicroseconds(1500); //set initial servo position if desired
  myservo.attach(7, 500, 2500);  //the pin for the servo control, and range if desired
  Serial.println("servo all-in-one test code 12-25-13"); // so I can keep track of what is loaded
  Serial.println();
}

void loop() {
  while (Serial.available()) {
    char c = Serial.read();  //gets one byte from serial buffer
    readString += c; //makes the string readString
    delay(2);  //slow looping to allow buffer to fill with next character
  }

  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured string

      // attach or detach servo if desired
    if (readString == "d") {
      myservo.detach(); //detach servo
      Serial.println("servo detached");
      goto bailout; //jump over writing to servo
    }
    if (readString == "a") {
      myservo.attach(7); //reattach servo to pin 7
      Serial.println("servo attached");
      goto bailout;
    }   

    n = readString.toInt();  //convert readString into a number

    // auto select appropriate value
    if(n >= 500)
    {
      Serial.print("writing Microseconds: ");
      Serial.println(n);
      myservo.writeMicroseconds(n);
    }
    else
    {   
      Serial.print("writing Angle: ");
      Serial.println(n);
      myservo.write(n);
    }

bailout: //reenter code loop
    Serial.print("Last servo command position: ");   
    Serial.println(myservo.read());
    Serial.println();
    readString=""; //empty for next input
  }
}
43  Using Arduino / Programming Questions / Re: Questions about Serial for continuous data project on: August 28, 2014, 09:45:51 pm
Serial data arrives slowly. Data may arrive at any time, on any serial port. Since you are mixing reading and printing, you will get confusion. What you need to do is read AND STORE the data, without printing it, from each port until the end of packet marker arrives. When that happens, print the stored data.

I see, So can I just put the values that I get from lets say; Serial1.Read and pass it to a string variable?

yes

http://forum.arduino.cc/index.php?topic=262658.msg1852993#msg1852993
44  Using Arduino / Programming Questions / Re: Program the alarm via a webpage... HELP on: August 28, 2014, 09:38:50 pm
You might be interested in using a text box web page like below where you enter the desired value.

Code:
//zoomkat 12-08-12
//get submit box code
//for use with IDE 1.0
//open serial monitor to see what the arduino receives
//use the \ slash to escape the " in the html or use a '
//address will look like http://192.168.1.102:84 when submited
//for use with W5100 based ethernet shields
//note that the below bug fix may be required
// http://code.google.com/p/arduino/issues/detail?id=605

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 1, 102 }; // ip in lan
byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(84);; //server port

String readString;

//////////////////////

void setup(){

  pinMode(5, OUTPUT); //pin selected to control
  //start Ethernet
  Ethernet.begin(mac, ip, gateway, gateway, subnet);
  server.begin();

  //enable serial data print
  Serial.begin(9600);
  Serial.println("server text box test1"); // so I can keep track of what is loaded
}

void loop(){
  // Create a client connection
  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();

        //read char by char HTTP request
        if (readString.length() < 100) {

          //store characters to string
          readString += c;
          //Serial.print(c);
        }

        //if HTTP request has ended
        if (c == '\n') {

          ///////////////
          Serial.println(readString); //see what was captured

          //now output HTML data header

          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();

          client.println("<HTML>");
          client.println("<HEAD>");
          client.println("<TITLE>Arduino GET test page</TITLE>");
          client.println("</HEAD>");
          client.println("<BODY>");

          client.println("<H1>HTML form GET example</H1>");

          client.println("<FORM ACTION='/' method=get >"); //uses IP/port of web page

          client.println("Pin 5 'on5' or 'off5': <INPUT TYPE=TEXT NAME='LED' VALUE='' SIZE='25' MAXLENGTH='50'><BR>");

          client.println("<INPUT TYPE=SUBMIT NAME='submit' VALUE='Change Pin 5!'>");

          client.println("</FORM>");

          client.println("<BR>");

          client.println("</BODY>");
          client.println("</HTML>");

          delay(1);
          //stopping client
          client.stop();

          /////////////////////
          if(readString.indexOf("on5") >0)//checks for on
          {
            digitalWrite(5, HIGH);    // set pin 5 high
            Serial.println("Led On");
          }
          if(readString.indexOf("off5") >0)//checks for off
          {
            digitalWrite(5, LOW);    // set pin 5 low
            Serial.println("Led Off");
          }
          //clearing string for next read
          readString="";

        }
      }
    }
  }
}

45  Using Arduino / Programming Questions / Re: How to display the text entered via serial monitor on: August 28, 2014, 09:32:45 pm
An alternative.

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 ... 642