Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: Serial read doesn´t work fine on: April 25, 2013, 01:42:03 pm
DEC is the default for "int" variables, so if you leave it off, it'll print the decimal value, never the character value.

Finally I don´t know what is happening to my arduino I checked three times uploading the program to the board and I got the same ascii values.....So I changed the program to this one:

 
Code:
char incomingByte[6];   // for incoming serial data
int i = 0;
void setup() {
        Serial.begin(9600);     // opens serial port, sets data rate to 9600 bps
}

void loop() {

        // send data only when you receive data:
        if (Serial.available() > 0) {
                // read the incoming byte:
                incomingByte[i] = Serial.read();
                i++;
        }
         if (incomingByte[i-1] == '.') {      // say what you got:
                incomingByte[i] = '\0';
                i=0;
                Serial.print("I received: ");
                Serial.println(incomingByte);
        }
}

Thank you all for your support!!! I will continue trying to know what caused the error....


Moderator edit: CODE TAGS
2  Using Arduino / Programming Questions / Re: Serial read doesn´t work fine on: April 25, 2013, 01:16:28 pm
@billroy: Thanks for your help!! I left off the "DEC" in the seial println command, but it continued displaying the same.  maybe there is a problem with my arduino....
@AWOL: Thanks for your help!!
3  Using Arduino / Programming Questions / Serial read doesn´t work fine on: April 25, 2013, 11:34:27 am
Hello everyone

I´m trying to received some data (orders)from the Serial port monitor to my arduino uno. When I received the values that I sent, it were wrong. As this didn´t work, I put another simple program to my arduino: please check the program and the serial monitor:

Program:

int incomingByte = 0;   // for incoming serial data

void setup() {
        Serial.begin(9600);     // opens serial port, sets data rate to 9600 bps
}

void loop() {

        // send data only when you receive data:
        if (Serial.available() > 0) {
                // read the incoming byte:
                incomingByte = Serial.read();

                // say what you got:
                Serial.print("I received: ");
                Serial.println(incomingByte, DEC);
        }
}


and my monitor displayed: (please check the attached screencapture)


What can cause this wrong values??


 
4  International / Proyectos / Consulta dato float Tx RF on: March 17, 2013, 06:26:38 pm
 Buenas tardes

Estoy desarrollando un proyecto de transmisión de datos. Necesito enviar un dato float por medio de un par de modulos RF 433 MHz(en una primera instancia solo como prueba, pues debo cambiar mis modulos por unos q me permitan alcanzar mayor distancia).
Buscando información encontré que puedo utilizar la libreria "VirtualWire".
Sin embargo yo necesito recolectar un dato float, el cual debe ser enviado remotamente, pero tengo algunas dudas:

1. Es necesario convertir el dato de float a string para su envío??
2. Es confiable convertir un dato float (con dos decimales) a string utilizando la función "dtostrf" y enviarlo sin perdida.??

Parte del codigo de adquisición de dato (para que se vea la magnitud de la variable float) es el sgte:

void setup()
{
  Serial.begin(9600);
  
  pinMode(clkPinA, INPUT);  
  pinMode(dirPinA, INPUT);  
  attachInterrupt(0, encoderIntA, RISING);
}

void loop()

{
 if (changeFlag)
 {
    changeFlag = false;
    distmm = ((encoderACount * 120) / 2405);

..........


Gracias.

5  Using Arduino / Sensors / Re: Linear Encoder on: December 05, 2012, 09:53:16 pm
From the company they said: "the encoder output is push pull"....

Ok, and at what voltage levels do the A, B, and Z output signals operate at? Unless you can get a copy of the complete datasheet I think we will be playing this answer/question/answer/question game for longer then either of us can handle. Between the complete exact model number printed on your device and it's datasheet, it is all so simple, but without, not so simple. If the output signals are switching from 0 to +24vdc you will have to wire two series resistor voltage dividers for each signal you want to use, A, B, Z, so that the signals will swing from 0 to +5vdc that arduino input pins can handle. After that it's just another quad encoder to deal with in software.

Lefty

Hi, finally I received the datasheet. The encoder output is pushpull, the electrical spec...second column for my encoder. Check the attached file please.
6  Using Arduino / Sensors / Re: Linear Encoder on: December 05, 2012, 10:32:42 am
I will push the vendor to give me the datasheet.....
7  Using Arduino / Sensors / Re: Linear Encoder on: December 05, 2012, 10:25:08 am
the same voltage at the input, in this case 24 V.

8  Using Arduino / Sensors / Re: Linear Encoder on: December 05, 2012, 07:45:53 am
From the company they said: "the encoder output is push pull"....
9  Using Arduino / Sensors / Re: Linear Encoder on: December 04, 2012, 07:49:19 am
Sorry...my mistake.. Now is attached..
10  Using Arduino / Sensors / Re: Linear Encoder on: December 03, 2012, 09:07:45 pm
Hi

Thanks for your reply!!
I found the datasheet of the sensor, even though I don´t understand how to connect it.
Could help me to understand it??? (in the attached file)

Thanks,
11  Using Arduino / Sensors / Linear Encoder on: December 03, 2012, 03:22:17 pm
Hello

I´m working on a project using an arduino uno and an encoder sensor. I have seen the wiring diagram for the rotary encoders and I watched that this encoder has only three pins: ground, A and B signal pins.
In my case I received an encoder with five cable connections: white and black for 0 and 24 V respectively; Red, green and yellow are A, B and Z signals respectively.

My question is..... How do I should connect the encoder to my arduino??

Thanks,
Pages: [1]