Show Posts
Pages: [1] 2 3 ... 596
1  Using Arduino / Programming Questions / Re: Uploading errors using windows xp on: Today at 10:46:11 am
After you reboot your computer do you then get the com 5 issue when the serial monitor is opened? If so, you can go into the arduino com port advanced properties and change the comport being used from com5 to another port like com6 and see if com6 can be used by the IDE.
2  Using Arduino / Project Guidance / Re: wifi web server that doesn't slow down a robot? on: Today at 10:39:31 am
Google is your friend for gaining knowledge of tcp/ip connections and http protocol. I set my code up such that the web server code is first just as a personal preference for following the code flow. When the server input buffer has data, the server code is run to provide the client with what is needed and then closed. Then the code flow moves on to other operations code being run. Does your bot code run as expected without the server code being included? Also, you probably need to detail what type of arduino you are using and what type of wifi hardware you are using (wifi shield or Ethernet shield connecting to a router). The servo pins 22 and 24 indicate you are not using a uno or similar board (mega?). Also, what pins are used for the sensors and what is the interrupt usage of the #include NewPing.h library? There may be conflicts between the NewPing.h library and Ethernet.h/SPI.h libraries.
3  Using Arduino / Programming Questions / Re: Uploading errors using windows xp on: Today at 09:16:16 am
If you know nothing is currently using com 5, you might go to device manager> serial port > properties > port settings > advanced for the arduino com port and ensure com 5 is assigned to the arduino.
4  Using Arduino / Project Guidance / Re: wifi web server that doesn't slow down a robot? on: Today at 08:27:41 am
I suggest you put the web server code in the main loop, and put the bot control code in conditional functions. Any significant delays need to check current time vs past time to avoid delays in program execution.


I don't think so. If the web browser misbehaves etc. then the connection will stay alive over a period of time too long for the robot to roam without sensing its environment. As I suggested already, OP should use state machine to take in each client byte at a time and NOT to run the server code like nothing else matters!

The arduino web servers are fairly robust when being connected to a well designed browser client. The OP's server code apparently runs on its own without issues. Adding the robot activities appear to be where the issues start. For trouble shooting I usually start with code that is known to work and slowly add discrete portions of new code until the code fails. For this project I'd start with the web server as the basic operation and then add a single bot activity at a time to the code and see if the combined code fails after a specific addition. Finding the point of failure is key to finding why the failure is occurring.
5  Using Arduino / Project Guidance / Re: wifi web server that doesn't slow down a robot? on: April 19, 2014, 11:19:25 pm
You might time and print the millisecond value of each loop to the serial monitor to see how long a single loop is taking. Most browsers will wait a couple of seconds for a server to respond to request. A test might be to remove any delays in the bot code to see if the server will start responding to request (the delay removal should not matter if all hardware is disconnected for testing).
6  Topics / Robotics / Re: big balancing robot on: April 19, 2014, 10:36:36 pm
Well, so far has been a bust. I need a board that can do everything I need. I can use a computer but can ros make a balancing robot?

Previous post concerning balancing robots. Perhaps your project is too ambitious.

https://www.google.com/search?as_q=balancing+robot&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=
7  Using Arduino / Programming Questions / Re: Uploading errors using windows xp on: April 19, 2014, 10:06:15 pm
In the past XP had some issues with USB serial ports. Each time a USB serial port was plugged in, a newer higher number com port was formed for the adapter. check in device manager to see if you have a number of serial ports showing.

edit: with the arduino plugged in to the usb port, check to see if the arduino has been assigned a different port number.
8  Using Arduino / Project Guidance / Re: wifi web server that doesn't slow down a robot? on: April 19, 2014, 09:38:18 pm
I suggest you put the web server code in the main loop, and put the bot control code in conditional functions. Any significant delays need to check current time vs past time to avoid delays in program execution.
9  Using Arduino / Project Guidance / Re: wifi web server that doesn't slow down a robot? on: April 19, 2014, 07:35:50 pm
You probably need to get rid of any delays in the bot control code. Any delays or loops there may prevent the server portion of the code from receiving a client request.
10  Using Arduino / Programming Questions / Re: multi analog data from 1 arduino to another arduino on: April 19, 2014, 07:07:43 pm
Quote
My question is how can i 3 analog signals from one to another arduino arduino send and then use that data for the motors?

I suggest you work on the receiving code first, making code that is easy to decode the incoming data stream. The receiving code below is for servo, but demonstrates receiving a numeric value with a component identifier, followed by a data packet delimiter. The sending code can be easily formatted in this manner.

Code:
//zoomkat 11-22-12 simple delimited ',' string parse
//from serial port input (via serial monitor)
//and print result out serial port
//multi servos added

String readString;
#include <Servo.h>
Servo myservoa, myservob, myservoc, myservod;  // create servo object to control a servo

void setup() {
  Serial.begin(9600);

  //myservoa.writeMicroseconds(1500); //set initial servo position if desired

  myservoa.attach(6);  //the pin for the servoa control
  myservob.attach(7);  //the pin for the servob control
  myservoc.attach(8);  //the pin for the servoc control
  myservod.attach(9);  //the pin for the servod control
  Serial.println("multi-servo-delimit-test-dual-input-11-22-12"); // so I can keep track of what is loaded
}

void loop() {

  //expect single strings like 700a, or 1500c, or 2000d,
  //or like 30c, or 90a, or 180d,
  //or combined like 30c,180b,70a,120d,

  if (Serial.available())  {
    char c = Serial.read();  //gets one byte from serial buffer
    if (c == ',') {
      if (readString.length() >1) {
        Serial.println(readString); //prints string to serial port out

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

        // auto select appropriate value, copied from someone elses code.
        if(n >= 500)
        {
          Serial.print("writing Microseconds: ");
          Serial.println(n);
          if(readString.indexOf('a') >0) myservoa.writeMicroseconds(n);
          if(readString.indexOf('b') >0) myservob.writeMicroseconds(n);
          if(readString.indexOf('c') >0) myservoc.writeMicroseconds(n);
          if(readString.indexOf('d') >0) myservod.writeMicroseconds(n);
        }
        else
        {   
          Serial.print("writing Angle: ");
          Serial.println(n);
          if(readString.indexOf('a') >0) myservoa.write(n);
          if(readString.indexOf('b') >0) myservob.write(n);
          if(readString.indexOf('c') >0) myservoc.write(n);
          if(readString.indexOf('d') >0) myservod.write(n);
        }
         readString=""; //clears variable for new input
      }
    } 
    else {     
      readString += c; //makes the string readString
    }
  }
}

11  Using Arduino / Project Guidance / Re: Newby ? - mega2560 and Ethernet shield to read (3) 1-5v inputs into desktop app on: April 19, 2014, 06:02:37 pm
Arduino server code that displays the arduino analog pin values in a web page.

Code:
// zoomkat's meta refresh data frame test page 8/17/13
// use http://192.168.1.102:84 in your brouser for main page
// http://192.168.1.102:84/data static data page
// http://192.168.1.102:84/datastart meta refresh data page
// for use with W5100 based ethernet shields
// set the refresh rate to 0 for fastest update
// use STOP for single data updates

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

const int analogInPin0 = A0;
const int analogInPin1 = A1;
const int analogInPin2 = A2;
const int analogInPin3 = A3;
const int analogInPin4 = A4;
const int analogInPin5 = A5;

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 1, 102 }; // arduino 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
unsigned long int x=0; //set refresh counter to 0
String readString;

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

void setup(){
  Serial.begin(9600);
    // disable SD SPI if memory card in the uSD slot
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);

  Ethernet.begin(mac, ip, gateway, gateway, subnet);
  server.begin();
  Serial.println("meta refresh data frame test 8/17/13"); // so I can keep track of what is loaded
}

void loop(){
  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
         if (readString.length() < 100) {
          readString += c;
         }
        //check if HTTP request has ended
        if (c == '\n') {

          //check get atring received
          Serial.println(readString);

          //output HTML data header
          //client.println("HTTP/1.1 200 OK");
          //client.println("Content-Type: text/html");
          //client.println();
         
          client.print(F("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n"));

          //generate data page
          if(readString.indexOf("data") >0) {  //checks for "data" page
            x=x+1; //page upload counter
            client.print(F("<HTML><HEAD>"));
            //meta-refresh page every 1 seconds if "datastart" page
            if(readString.indexOf("datastart") >0) client.print(F("<meta http-equiv='refresh' content='1'>"));
            //meta-refresh 0 for fast data
            if(readString.indexOf("datafast") >0) client.print(F("<meta http-equiv='refresh' content='0'>"));
            client.print(F("<title>Zoomkat's meta-refresh test</title></head><BODY><br>"));
            client.print(F("page refresh number: "));
            client.print(x); //current refresh count
            client.print(F("<br><br>"));
           
              //output the value of each analog input pin
            client.print(F("analog input0 is: "));
            client.print(analogRead(analogInPin0));
           
            client.print(F("<br>analog input1 is: "));
            client.print(analogRead(analogInPin1));
                       
            client.print(F("<br>analog input2 is: "));
            client.print(analogRead(analogInPin2));
           
            client.print(F("<br>analog input3 is: "));
            client.print(analogRead(analogInPin3));
                                   
            client.print(F("<br>analog input4 is: "));
            client.print(analogRead(analogInPin4));
           
            client.print(F("<br>analog input5 is: "));
            client.print(analogRead(analogInPin5));
            client.print(F("<br></BODY></HTML>"));
           }
          //generate main page with iframe
          else
          {
            client.print(F("<HTML><HEAD><TITLE>Zoomkat's frame refresh test</TITLE></HEAD>"
            "Zoomkat's Arduino frame meta refresh test 8/17/13"
            "<BR><BR>Arduino analog input data frame:<BR>"
            "&nbsp;&nbsp;<a href='/datastart' target='DataBox' title=''yy''>META-REFRESH</a>"
            "&nbsp;&nbsp;&nbsp;&nbsp;<a href='/data' target='DataBox' title=''xx''>SINGLE-STOP</a>"
            "&nbsp;&nbsp;&nbsp;&nbsp;<a href='/datafast' target='DataBox' title=''zz''>FAST-DATA</a><BR>"
            "<iframe src='/data' width='350' height='250' name='DataBox'>"
            "</iframe><BR></HTML>"));
          }
          delay(1);
          //stopping client
          client.stop();
          //clearing string for next read
          readString="";
        }
      }
    }
  }
}

12  Using Arduino / Project Guidance / Re: Need some additional guidance on a robotic project on: April 19, 2014, 05:49:13 pm
Quote
He suggested to me to create an audio output depending on what the sensor detects, I was thinking of taking it further and connect it with an android phone, so it displays what the sensor detects if anything and how far it is ahead of it  (with the sensor only capable of detecting 50cm at best)and maybe giving off a small audio, so a beep, faster beeps meaning its getting closer to the object maybe,

I'd suggest that the bot look for something. Perhaps it could remember where it has been (some type of mapping), and continue to search new areas. Something simple like an IR beacon could be the searched for object.
13  Using Arduino / Programming Questions / Re: How to fix this servo code on: April 19, 2014, 05:05:56 pm
Seems some people have a lot idle time.

Code:
#include <Servo.h>

//int motorPinA = 10;
int ledPin = 3;
int repetitions = 0;
int iterations = 0;
//int motorPinB = 5;
//int motorPinC = 8;

//int servoA;
//int servoB;
//int servoC;

Servo servoA;
Servo servoB;
Servo servoC;

// Sweep
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.

//Servo myservo;  // create servo object to control a servo
// a maximum of eight servo objects can be created

int servoPosA = 0;    // variable to store the servo position, all sevo positions start at zero, as they should.
int servoPosB = 0;
int servoPosC = 0;

void setup()
{
  int ledPin;
  //int motorPin;
  //pinMode (motorPinA, OUTPUT);
  pinMode(ledPin, OUTPUT);
  int repetitions;
  int iterations;
  int myservo;

  //int motorPinB;
  //pinMode(motorPinB, OUTPUT);
  servoA.attach(5);  // attaches the servo (A) on pin 5 to the servo object
  servoB.attach(8);  // a servo (B) is attached to pin 8
  servoC.attach(9);  // a servo (C) is attached to pin 9
}

void loop()
{
  if(iterations >= 2)
  {
    //analogWrite(motorPinA, LOW);
    analogWrite(ledPin, 0);
    //Servo A needs to go to zero, 0, closed, and stay there when   
  }
  else
  {
    for(int repetitions=0;repetitions<2;repetitions++)
    {
      delay(2000);
      analogWrite(ledPin, 1000);
      delay(2000);
      //Servo A needs to go to 90 degrees, open

      for(servoPosA = 0; servoPosA < 90; servoPosA += 1)  // goes from 0 degrees to 180 degrees
      {                                  // in steps of 1 degree
        servoA.write(servoPosA);              // tell servo to go to position in variable 'pos'
        delay(15);                       // waits 15ms for the servo to reach the position
      }
      for(servoPosA = 90; servoPosA>=1; servoPosA-=1)     // goes from 180 degrees to 0 degrees
      {                               
        servoA.write(servoPosA);              // tell servo to go to position in variable 'pos'
        delay(15);

        //analogWrite(motorPinA, 70);
        delay (3000);

        analogWrite(ledPin, 0);
        //servo A needs to be at 0, closed

        //analogWrite(motorPinA, LOW);
        iterations++;           // # value of iterations is counted up by one.

        if(iterations % 2 ==1) // this will devide iteraions by two and every time there is a remainder of one (AKA each time there is an odd number, AKA every other iteration, an (#.5 number) because that remainder 1 gets divided by two to make a .5*2 = 1, AKA once per day!)
          // This means that we can give her the twice-a-day-pills and then give her the once a day pills! We just need to adjust the timeing to match a 24-hour day!
        {
          delay(10); //debounce the system
          //make servos B and C run for once a day

          //analogWrite(motorPinB, 80);
          //delay(300);               Motor A and Motor B may have a need for different speeds, depending on the size and shape of each of the various pills we dispense. Use this code if this is necessary
          //analogWrite(motorPinC, 80);
          delay(300); //how long the motors need to run to spit out exactly one pill of each
        }
        else
        {
          delay(10); //debounce the system

          // leave servos B and C stay off on the even(second) run of servo A, meaning that A gives twice a day while B and C give once a day.
          //analogWrite(motorPinB, LOW); //this is a pill that is given only once a day, motor left off
          //analogWrite(motorPinC, LOW); //this is a pill that is given only once a day, motor left off
        }
      }
    }
  }
}

14  Using Arduino / Project Guidance / Re: Need some additional guidance on a robotic project on: April 19, 2014, 04:16:25 pm
Quote
You may have seen my last topic on this autonomous robot project which I have started and have made quite a lot of progress on.

Such as...? You really don't need a complete bot to write your programming. You can have the arduino print out what it is doing to the serial monitor without actually controlling motors and such. Below are youtube videos that may have projects similar to what you seek. Bottom are robot kits that might get you started. What have you done so far with your robot project?

https://www.youtube.com/results?search_query=arduino+robot+car

http://www.ebay.com/sch/i.html?_odkw=arduino+robot+car&LH_BIN=1&_sop=15&_osacat=0&_from=R40&_trksid=p2045573.m570.l1313&_nkw=arduino+robot+car+kit&_sacat=0
15  Using Arduino / General Electronics / Re: Inverse multiplexer? on: April 19, 2014, 12:32:06 pm
Quote
Not having heard further from "Oddwired", we have not found out what he really wanted to do; I rather suspect something quite different.

I think the request is fairly straight forward.  smiley-cool
Pages: [1] 2 3 ... 596