| Arduino Forum ::  Members :: noxasdj
 Show Posts Pages: [1] 2 3 ... 5
 1 Using Arduino / Programming Questions / Re: Run 2 pieces of code at the same time. on: August 30, 2012, 08:24:17 am Thanks PaulS, I am going to have a look on the website
 2 Using Arduino / Programming Questions / Re: Run 2 pieces of code at the same time. on: August 30, 2012, 08:11:47 am Quote]What do these connect to:dirPinX(no dirPinX2?)dirPinYdirPinY2stepPinX(no stepPinX2?)stepPinYstepPinY2I have 3 step motors, 1 for the x axis and 2 for the y axis. Each step motor needs a direction and step pin.
 3 Using Arduino / Programming Questions / Run 2 pieces of code at the same time. on: August 30, 2012, 07:55:01 am I am making a homemade printer that draws shapes and I'm trying to make a circle but the stepper motors  are not working good. They aren't as fluid as they should. Here is the code: Code:void loop() {  for (int angle = 0; angle <360; angle ++) {   float angleRad = angle*2*PI/360;   x = int(xInicial + cos(angleRad) * radi);   y = int(yInicial + sin(angleRad) * radi);    if (x <0) {       digitalWrite(dirPinX, LOW);     }    if (x >0) {       digitalWrite(dirPinX, HIGH);     }    x = abs(x);     if (y<0) {      digitalWrite(dirPinY, LOW);       digitalWrite(dirPinY2, LOW);    }    if (y>0) {      digitalWrite(dirPinY, HIGH);       digitalWrite(dirPinY2, HIGH);    }    x = abs(x);    y = abs(y)*2;    Serial.println(x);    for (int i=0; i
 4 Using Arduino / General Electronics / Stepper motors are not working on: August 23, 2012, 12:51:04 pm Hey guys,I have a problem. I bought two steppershttp://dlnmh9ip6v2uc.cloudfront.net/datasheets/Robotics/57BYGH420.PDF and two big easy driver http://www.schmalzhaus.com/BigEasyDriver/ to make them work. I connected them as it is shown in the website, but when I tried to make them go they didn't work. They make like strange noise and vibrate but don't actually move. I use a 500 power supply which gives 25A d.c. Where is the mistake? Thanks
 5 Using Arduino / Programming Questions / Re: Help in Split String into Array on: June 28, 2012, 11:43:41 am QuoteIs it still defined as   String myArray[2];?Yes it is. The problem is that I don't know how to handle the incoming data. I mean a entire  word (e.g. RB) and an hole number (e.g 125) in a 2 positions char array.
 6 Using Arduino / Programming Questions / Re: Help in Split String into Array on: June 28, 2012, 10:17:11 am Ok, now I understood your code and I've modified a bit but I'm still getting wrong values in the serial monitor.Here is the codeCode:void loop() {  if (Serial.available() >=7) {    char c_Temp[3] = {0,0,0};    c_Temp[0] = Serial.read();    c_Temp[1] = Serial.read();    c_Temp[2] = Serial.read();    if (c_Temp[2] = ',') {      myArray[0] = c_Temp;    }    c_Temp[0] = Serial.read();    if(c_Temp[0] !=0) {    c_Temp[1] = Serial.read();      if (c_Temp[1] !=0) {        c_Temp[2] = Serial.read();      }     myArray[1] = c_Temp;    } else {     myArray[1] = 0;    }  Serial.println(myArray[0]);  delay (50);}Serial.println prints:Code:R,......B,,....RB,....R,....,....0,....10,....,1,....B,,....RB,....
 7 Using Arduino / Programming Questions / Re: Help in Split String into Array on: June 28, 2012, 09:18:48 am Quoteif you are expecting a certain sequence it is better to wait for enough data rather than do stuff when anything is available.The problem is that I don't know how long is going to be the value 'cause it may vary from 0 to 255.And I am still having the same trouble parsing the string into array. Sorry these gets quite complicated for me.
 8 Using Arduino / Programming Questions / Re: Help in Split String into Array on: June 28, 2012, 08:56:15 am Thank you for reply,I tried to use your improvements, and I am getting bad values:Code:,1RBThis is the code:Code:  if (Serial.available() > 0) {     /*int h=Serial.available();            // if you are getting escape -characters try h--; here      for (int i=0;i0) I am losing 0 values, for example if I send value 10, I just get back 1. I don't know if you understand me.
 9 Using Arduino / Programming Questions / Help in Split String into Array on: June 28, 2012, 06:47:07 am Hey guys,I thought that splitting strings was easier than in fact it is. Here is my code:Code:String inData;String myArray[2];void loop() {  inData = "";  if (Serial.available() > -1) {     int h=Serial.available();          for (int i=0;i
 10 Using Arduino / Programming Questions / Re: Help Rotary encoder on: May 23, 2012, 01:39:55 pm Yes, in fact the code is working good, the encoder is counting from 0 to 255, if I turn the knob clockwise and it reverses if I go counterclockwise. First problem is that "almost" ,and I say almost 'cause is not always, every time it counts +4 steps or -4 depending the direction. Using this code I could know if the weather vane is turning clockwise or counter clockwise, but I can't get the actually position of the knob to determinate north, south, east, west.
 11 Using Arduino / Programming Questions / Help Rotary encoder on: May 23, 2012, 12:52:02 pm Hey guys,I bought a rotary encoder from sparkfun (http://www.sparkfun.com/products/9117). I have never worked with rotary, first I thought that it was like a potentiometer, but it doesn't. So my question is: Is it possible to know the direction of the encoder? I want to built a weather vane using this encoder as a way to know the direction of the wind. (N,S,E,W).I've this piece of code from http://www.circuitsathome.com/mcu/programming/reading-rotary-encoder-on-arduino, but I don't understand almost anything, even reading the website which is explained. Maybe it is not the best way to start. Thank you.Code:/* Rotary encoder read example */#define ENC_A 14#define ENC_B 15#define ENC_PORT PINC void setup(){  /* Setup encoder pins as inputs */  pinMode(ENC_A, INPUT);  digitalWrite(ENC_A, HIGH);  pinMode(ENC_B, INPUT);  digitalWrite(ENC_B, HIGH);  Serial.begin (115200);  Serial.println("Start");} void loop(){ static uint8_t counter = 0;      //this variable will be changed by encoder input int8_t tmpdata; /**/  tmpdata = read_encoder();  if( tmpdata ) {    Serial.print("Counter value: ");    Serial.println(counter, DEC);    counter += tmpdata;  }} /* returns change in encoder state (-1,0,1) */int8_t read_encoder(){  static int8_t enc_states[] = {0,-1,1,0,1,0,0,-1,-1,0,0,1,0,1,-1,0};  static uint8_t old_AB = 0;  /**/  old_AB <<= 2;                   //remember previous state  old_AB |= ( ENC_PORT & 0x03 );  //add current state  return ( enc_states[( old_AB & 0x0f )]);}
 12 Using Arduino / General Electronics / Re: proximity sensor + electret microphone = no compatible?? on: May 15, 2012, 04:48:15 am They've been wired normally. 3 pins for each component. Voltage,ground and analog in. proximity sensor is in A1 and microphone in A2The code is just for the electret microphone as I said before. Because the problem appears when I wire the proximity sensor at the same voltage line of the microphone.
 13 Using Arduino / General Electronics / proximity sensor + electret microphone = no compatible?? on: May 14, 2012, 01:14:55 pm Hey guys,I am having a trouble when I connect and infrared proximity sensor (http://www.sparkfun.com/products/242) and an preamplified electret microphone (http://www.sparkfun.com/products/9964).When I connect the sensors separately, they work perfect, but when I connect both together the electret microphone reads signal of 1023 (5V) at all time.Do I have to get the voltage from different power sources? That would be very weird.Thanks,Here I leave you the electret mic sketch to read the signal if its necessary.Code:const int micPin = A2;   int valueMic = 0;int valueMicMax = 512;int valueMicMin = 512;void setup() {  Serial.begin(9600);}void loop() {  for (int i =0; i < 100; i++){    valueMic = analogRead(micPin);    if (valueMic > valueMicMax){      valueMicMax = valueMic;    } else {     if (valueMic < valueMicMin){      valueMicMin = valueMic;      }    }    }  valueMic = valueMicMax-valueMicMin;  Serial.println(valueMic);  valueMicMax = 512;  valueMicMin = 512;}
 14 Using Arduino / Project Guidance / Re: About proximity sensors on: February 17, 2012, 01:26:08 pm I am a bit lost with which would be the best choice.This one using an IR LED and a photoresistor:http://www.reconnsworld.com/ir_ultrasonic_basicirdetectemit.htmlor this one using a QRD1114 IR emitted / Phototransistor.http://bildr.org/2011/03/various-proximity-sensors-arduino/
 15 Using Arduino / Project Guidance / Re: About proximity sensors on: February 17, 2012, 11:57:15 am Then an IR LED and a IR receiver would be a the best choice? Because maybe the hole isn't always completely dark.
 Pages: [1] 2 3 ... 5