Show Posts
Pages: [1] 2 3 ... 642
1  Using Arduino / Project Guidance / Re: Arduino motor control. on: Today at 07:38:22 pm
Quote
Can I connect them in series and use just one power supply?

Connect them in parallel and use a single power supply.
2  Using Arduino / Programming Questions / Re: Interacting with my sketch via a web page on: Today at 07:22:47 pm
Quote
For example, if my initial sketch hardcoded Temperature parameters are set to turn the Fan on when T > 85 degrees F, then turn off again when the T < 78 degrees F--but now I want to lower my high point to only 80 degrees F instead of 85, and lower my lower point to 75 degrees F.  Can I do this without recoding my sketch and reloading it?

You should be able to. In your server code set the deg values as a variable, then send new variable values to the server via client GET request.
3  Using Arduino / Programming Questions / Re: changing values over serial monitor on: Today at 06:59:51 pm
The below code is for servos, but might be of value for your project. A numeric value is sent to the arduino via the serial monitor. The string of bytes sent is captured as readString. The captured readString is then converted into a number. Then the number is available for use.

Code:
//zoomkat 7-30-10 serial servo test
//type servo position 0 to 180 in serial monitor

String readString;
#include <Servo.h>
Servo myservo;  // create servo object to control a servo

void setup() {
  Serial.begin(9600);
  myservo.attach(9);
  Serial.println("servo-test"); // so I can keep track of what is loaded
}

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
    int n = readString.toInt();  //convert readString into a number
    myservo.write(n);
    readString="";
  }
}

4  Using Arduino / Programming Questions / Re: Manipulating sequence numbers received through the serial port. on: Today at 02:06:54 pm
The best starting point is to working on the simplest way to decode your data, then work on sending the data in that format. As to decoding, sending the data to the arduino with a data delimiter then capturing the whole data packer makes parsing the data into individual components easier. Below is basic parsing test code that shows the basic concept.

Code:
//zoomkat 11-12-13 String capture and parsing 
//from serial port input (via serial monitor)
//and print result out serial port
//copy test strings and use ctrl/v to paste in
//serial monitor if desired
// * is used as the data string delimiter
// , is used to delimit individual data

String readString; //main captured String
String angle; //data String
String fuel;
String speed1;
String altidude;

int ind1; // , locations
int ind2;
int ind3;
int ind4;
 
void setup() {
  Serial.begin(9600);
  Serial.println("serial delimit test 11-12-13"); // so I can keep track of what is loaded
}

void loop() {

  //expect a string like 90,low,15.6,125*
  //or 130,hi,7.2,389*

  if (Serial.available())  {
    char c = Serial.read();  //gets one byte from serial buffer
    if (c == '*') {
      //do stuff
     
      Serial.println();
      Serial.print("captured String is : ");
      Serial.println(readString); //prints string to serial port out
     
      ind1 = readString.indexOf(',');  //finds location of first ,
      angle = readString.substring(0, ind1);   //captures first data String
      ind2 = readString.indexOf(',', ind1+1 );   //finds location of second ,
      fuel = readString.substring(ind1+1, ind2+1);   //captures second data String
      ind3 = readString.indexOf(',', ind2+1 );
      speed1 = readString.substring(ind2+1, ind3+1);
      ind4 = readString.indexOf(',', ind3+1 );
      altidude = readString.substring(ind3+1); //captures remain part of data after last ,

      Serial.print("angle = ");
      Serial.println(angle);
      Serial.print("fuel = ");
      Serial.println(fuel);
      Serial.print("speed = ");
      Serial.println(speed1);
      Serial.print("altidude = ");
      Serial.println(altidude);
      Serial.println();
      Serial.println();
     
      readString=""; //clears variable for new input
      angle="";
      fuel="";
      speed1="";
      altidude="";
    } 
    else {     
      readString += c; //makes the string readString
    }
  }
}

5  Using Arduino / Programming Questions / Re: How to send a float over Serial to another controller. on: Today at 01:42:52 pm
If the temperature float is received as a string of characters like 74.22, just capture the characters and retransmit them with a carriage return or line feed appended appended to them. The mega has several of hardware serial ports so you might consider using them instead of software serial.
6  Using Arduino / Project Guidance / Re: Arduino motor control. on: Today at 01:24:24 pm
Quote
My question is do I need a battery to power the motor?

You need an external power supply for high current loads like motors. The below link may have some info of interest.

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

7  Using Arduino / Project Guidance / Re: Robot arm for PCB etching on: Today at 01:18:14 pm
Quote
I was thinking about 'outsourcing' the mechanical issues by buying this robot arm.....

You really should look at making a small and simple CNC table. If the PCB size is small, then servos might be used. Check youtube for ideas.
 
8  Using Arduino / Programming Questions / Re: Serial.readString() is extremely slow on: Today at 01:48:51 am
   Seems like you code doesn't work.

by your code it should print "Simple serial echo test"   twice...

but it does only once..

Bzzzzzzzt!!! Note the below in the code header. Type or paste "010c 41 0C 4D 67" in the serial monitor and the arduino will captures the sent characters into a String, then send it back to the serial monitor.

Code:
//type type text in serial monitor and send
9  Using Arduino / Programming Questions / Re: converting a string to int - reading file from SD Card on: Today at 01:40:59 am
On the other hand I think the behavior of PaulS toward new forum members is becoming an increasing forum embarrassment to me and maybe other members of the forum. Sad.   smiley-roll-blue
10  Using Arduino / Programming Questions / Re: Serial.readString() is extremely slow on: Today at 01:21:25 am
I looked at the readString() documentation and it seems to circular without any example code. It also says "reads characters from a stream into a string" and not a String. I suggest you capture your own String somewhat like below then parse out the info you desire.

Code:
//zoomkat 6-29-14 Simple serial echo test
//type type text in serial monitor and send

String readString;

void setup() {
  Serial.begin(9600);
  Serial.println("Simple serial echo test"); // so I can keep track of what is loaded
}

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
    readString="";
  }
}

11  Using Arduino / Programming Questions / Re: Serial.readString() is extremely slow on: Today at 12:56:41 am
Where did you find Serial.readString() and what is it supposed to do? Don't remember seeing this String function before.
12  Using Arduino / Programming Questions / Re: Serial.readString() is extremely slow on: August 31, 2014, 11:59:35 pm
You may want to get rid of the below as it is probably not doing what you think.

Code:
Serial1.flush();
13  Using Arduino / Programming Questions / Re: Serial.readString() is extremely slow on: August 31, 2014, 11:23:00 pm
Quote
Check it out you will be surprise then...

If you can't post your code in this forum you will probably wind up being ignored.
14  Using Arduino / Programming Questions / Re: how to read float number sent from matlab to Arduino on: August 31, 2014, 11:20:11 pm
Quote
how to convert the return of Serial.read() into float format directly and get the accurate inputs?

The serial port sends/receives bytes without regard as to what they are supposed to represent. You need to capture the bytes sent to the serial port, then apply some function that turns the bytes sent into what you want the bytes represent. 0.3 is just three ascii characters just as the word the is three ascii characters. You need to convert the bytes into what you expect them to represent.
 
15  Using Arduino / Programming Questions / Re: Serial.readString() is extremely slow on: August 31, 2014, 11:05:56 pm
Quote
But what I find out is that everything works but readString() function is extremely slow. It takes about 2,5 sec or 2500 mili seconds to execute.....    It is like a FOREVER...  It is unacceptable.

The String functions work work fast for me, so it is probably some issue with your code.
Pages: [1] 2 3 ... 642