Show Posts
Pages: 1 ... 38 39 [40] 41 42 ... 251
586  Using Arduino / Programming Questions / Re: need help in my programe . on: June 16, 2014, 11:42:38 am
Here is an example function:
Code:
byte LMF = 3;// PWM Left motor forward pin
byte LMR = 5;// PWM Left motor Reverse pin
byte RMF = 11;// PWM Right motor forward pin
byte RMR = 6;// PWM Right motor reverse pin

/*Rest of code here*/

void move(int z, int y, int DZ)// z = analog_1, y = analog_2, DZ = dead/neutral zone factor.
{  
  //Movement varibles
  int DRV2 = map(z, 0, 512 - DZ, 255, 0);
  int DRV1 = map(z, 512 + DZ, 1023, 0, 255);
  int STRL = map(y, 0, 512 - DZ, 255, 0);
  int STRR = map(y, 512+ DZ, 1023, 0, 255);

  if(z > 512)//forwards              
  {
    //Serial.println("Forward with turning");
    analogWrite(LMF, constrain(abs(DRV1 - STRL),0,255));
    analogWrite(RMF, constrain(abs(DRV1 - STRR),0,255));  
    digitalWrite(LMR, LOW);
    digitalWrite(RMR, LOW);  
  }
  else if(z < 512)//backwards              
  {
    //Serial.println("Reverse with turning");
    digitalWrite(LMF, LOW);
    digitalWrite(RMF, LOW);  
    analogWrite(LMR, constrain(abs(DRV2 - STRL),0,255));
    analogWrite(RMR, constrain(abs(DRV2 - STRR),0,255));  
  }
  else if(z == 512 && y > 512)//Right              
  {
    //Serial.println("360 left");
    digitalWrite(LMR, LOW);
    analogWrite(RMR, STRR);  
    analogWrite(LMF, STRR);
    digitalWrite(RMF, LOW);
  }
  else if(z == 512 && y < 512)//Left              
  {
    //Serial.println("360 right");
    analogWrite(LMR, STRL);
    digitalWrite(RMR, LOW);  
    digitalWrite(LMF, LOW);
    analogWrite(RMF, STRL);  
  }

  else //full stop
  {
    digitalWrite(LMF, LOW);
    digitalWrite(RMF, LOW);        
    digitalWrite(LMR, LOW);
    digitalWrite(RMR, LOW);    
  }
}
587  Using Arduino / Programming Questions / Re: need help in my programe . on: June 16, 2014, 11:24:14 am
Quote
if i can't user more than one pin , and i can't call function like [ auto_pikot()] ..
I asked when does the function ever get called?

Quote
the code i wrote i finished it , i but it just to understand for whom reading my topic ...
??? Can you post your finished code.
588  Using Arduino / Programming Questions / Re: need help in my programe . on: June 16, 2014, 11:04:06 am
Quote
analogWrite(here i want to put more than one pin(m1_f + m2_f) , motors_value1);
  analogWrite(m1_b , motors_value2);

You can't use more than one pin like that, you need to split them up.

Quote
  delay(4000);
  robot_left();
  if (sen4_val==HIGH){robot_stop();
  delay(1000);
  robot_down();
  delay(8000);
  robot_arm_hold();
  delay(3000);
  robot_arm_stop();
  delay(1000);
  robot_up();
  delay(3000);
These delays are going to be an issue, because they won't let you do anything else until they are done. So if that IF statement condition is true, then you will need to wait until it is false to do anything afterward. But if your willing to wait, then you can use it, but I highly recommend you look into the Blink Without Delay example for a better "delay" solution.

One more thing, when does auto_pilot() ever get called?
589  Using Arduino / Project Guidance / Re: analog keyboard interfacing on: June 16, 2014, 10:46:59 am
You might not be able to use just the keystroke and value as one, so you might need to first send the key then the value after it and make sure you get both.

Or you could probably send a Struct composed of the key and value, then on the receiving side split them up to their appropriate places. I never tried it before, but it should work.

Are you using the Keyboard library, because I didn't know it was compatible with an Arduino Micro.
590  Using Arduino / Audio / Re: Can anyone recommend a voice recognition module? on: June 16, 2014, 10:27:26 am
How many commands are you looking to have?
I have this module, it can have 3 groups consisting of 5 words each. I would walk you through it, but the driver is not compatible with my Windows 8 laptop ( Win 7 and under).

Another is this one. Dfrobot Speech Recognition Module I'm not sure how good it is.

Finally there is the EasyVR It supports 32 words and from what I've heard it is quite easy to setup. Kinda expensive though.
591  Using Arduino / Displays / Re: Trouble compiling examples for the UTFT Library on: June 16, 2014, 08:49:32 am
Quote
UTFT.h: No such file or directory
This is big hint to consider. The compiler can't find your library, so where did you put it?
592  Using Arduino / Project Guidance / Re: analog keyboard interfacing on: June 16, 2014, 08:44:16 am
What about a racing game? Pressure sensitive keys will allow you to increase/decrease speed depending on the pressure applied to the key.

Another is maybe a pinball game. We all tend to hit the button/paddle harder in order to hit the ball harder, don't we?
593  Using Arduino / Programming Questions / Re: Question on a 2x2x2 LED cube? on: June 15, 2014, 09:37:02 pm
You can use a shift register, they only need three pins, clock, data and latch.

Another option is charlieplexing.
594  Using Arduino / Programming Questions / Re: Need some help on: June 15, 2014, 07:32:35 pm
He should be using the Blink Without Delay method and he should also have a flag that lets the code know when the LED is on and off.  This way it cuts down the processing time.

595  Development / Other Software Development / Re: performance of map() function - an analysis on: June 15, 2014, 04:51:47 pm
Couldn't you just use a template? This way instead of having multiple functions, you just have one that changes its type.
596  Development / Other Software Development / Re: New TFT Extension Library on: June 15, 2014, 11:29:40 am
Edit:
Sorry about that.

As for the version, there is most likely going to be one more coming out and that's the new keyboard layouts (iOS and Android style) and maybe a clock face, maybe.

Other than that, I think i'm finally done.

But I'll add the version in.

Below is just the .cpp file, you can replace the one you have with this one.
597  Development / Other Software Development / Re: New TFT Extension Library on: June 14, 2014, 11:39:29 pm
Slight update:
I fixed some things in the Smiley face function and got rid of the extra pixel at 0 deg.

And put the keyboard characters in the PROGMEM

598  Using Arduino / Programming Questions / Re: Still having trouble with the time on: June 14, 2014, 11:38:20 am
Ok, that works, this way if its a single digit, it gets printed as 11:05:09 instead of 11:5:9
599  Using Arduino / Programming Questions / Re: Still having trouble with the time on: June 14, 2014, 10:36:50 am
You can use the sprintf() function to store the time in a string(char array)  and print it out as one.

Code:
char buffer[10]; // this needs to be big enough to fit everything

void setup()
{
  Serial.begin(115200);
 
  sprintf(buffer, " %d:%d:%d", 11, 33, 55); // replace 11,33,55 with hour(), min(), second()
  Serial.print(buffer);
}

void loop() {}

Output:
11:33:55

You can change buffer to curTime if you want.
600  Using Arduino / Displays / Re: Adafruit library TFT colours on: June 13, 2014, 10:04:29 am
Try this. it should convert the standard RGB(255,255,255) to 565 format (FFFF)

Edit: Sorry, try it now.
Code:
word ConvertRGB( byte R, byte G, byte B)
{
  return ( ((R & 0xF8) << 8) | ((G & 0xFC) << 3) | (B >> 3) );
}

Matched results to Henning Karlsen's color picker
I personally prefer the standard RGB value, but the 565 format is great for color fading animations and color wheels.
Pages: 1 ... 38 39 [40] 41 42 ... 251