Show Posts
Pages: 1 ... 15 16 [17] 18 19 ... 197
241  Development / Other Software Development / Re: New TFT Extension Library on: March 02, 2014, 06:03:04 pm
Library updated. Added Connect Four game.

Note: I'm currently working on the AI for the connect four game and as of this version, the computer is really dumb. If you look at the function to play against the computer, you'll see its just a few random functions and nothing else. So I am working on making it a bit more of a challenge, and so far it is going good.

After I get the AI to work, I am going to make the game wireless. Maybe not WiFi right now, because I don't have a WiFi module, but it will definitely be Bluetooth.
242  Using Arduino / Project Guidance / Re: Idea for project - need guidance? on: March 02, 2014, 04:46:46 pm
Quote
What is the difference between different bluetooth modules?
Mostly the protocol, some modules are more secure than others meaning they need a password or key to access them. Others can only be paired to certain devices like the module I gave you, doesn't pair up with a IPhone, at least not easily, but it works with Android rather well. Some can transfer data faster than others and some can only transfer audio. It really depends on what you need.

But what I gave you should work fine, its what most use, myself included.

243  Using Arduino / Project Guidance / Re: Idea for project - need guidance? on: March 02, 2014, 11:49:53 am
You will can use a bluetooth module like this one here.

You can then send characters from the computer with a terminal program like Realterm or Putty.
244  Using Arduino / Programming Questions / Re: can i set more then 1 LED to HIGH in one digitalWrite? on: March 02, 2014, 10:19:31 am
Use a FOR loop.
245  Using Arduino / Project Guidance / Re: biggest in an array on: March 01, 2014, 05:45:12 pm
Its actually incredibly simple. You will need a loop of some kind if your not using the loop function. What you can do is, with that "loop" you can cycle through the array, while it is in the max() function. Now the max function will need to variables to compare, and the larger variable will be the output.
Example:
x= max(a, b);

What you can then do, is set the output "x" to 0 (globally at the top of your sketch, NOT within the loop itself). Then compare your array to the output. Which ever is bigger, will update "x"

for(byte idx = 0; idx < 180; idx++)
{
  x = max( array[ idx ], x );
}
print the output variable "x"  afterwards.
246  Using Arduino / Programming Questions / Re: Bit stuck on bit manipulations ? on: March 01, 2014, 04:51:38 am
Just what's inside the parentheses. And you can mix and match different types too, your most likely going to lose precision, but it can be done.
float( int(123) ) = 123.0 . But int(123.5) = 124.
I'm not sure what happens to long variable when you make them ints or bytes, it probably rolls over.

Did a test with just a few.
Code:
void setup()
{
Serial.begin(9600);
Serial.println(float(int(123)));
Serial.println(float(long(123456)));
Serial.println(int(long(123456)));
Serial.println(long(float(12.3456)));
Serial.println(char(long(123456)));
}

void loop() { }

Output.
Quote
123.00
123456.00
-7616
12
@
247  Using Arduino / Programming Questions / Re: Bit stuck on bit manipulations ? on: March 01, 2014, 04:17:00 am
701 * 200 goes outside (actually it rolls over) the INT range. This should work, float(tempCount * 200). It would be a lot better if you typecast everything on the line as a float. More precision that way.
248  Using Arduino / Programming Questions / Re: Help with Science Fair Project Code. on: February 28, 2014, 07:16:38 pm
Are those values being sent from the app or serial monitor?
249  Using Arduino / Programming Questions / Re: Help with Science Fair Project Code. on: February 28, 2014, 06:40:20 pm
Quote
I get back values such as 49 and 50.
ok good, you get back what you send in, just in decimal.

So my next question is, what is it not doing, that it should be doing?
250  Using Arduino / Programming Questions / Re: Bit stuck on bit manipulations ? on: February 28, 2014, 06:36:34 pm
Oh, then in that case its simple, shift 5BC0 to the right 5 bits.
Code:
int Pressure = (B_1 << 8) | B_2; // this is fine
int Temp = (B_3 << 8) | B_4; //this produces 5BC0
Temp >>=5; // 5BC0 >> 5 = 02DE
251  Using Arduino / Programming Questions / Re: Bit stuck on bit manipulations ? on: February 28, 2014, 05:41:53 pm
Do you mean like this?
Code:
void setup()
{
Serial.begin(115200);

byte B_1 = 0xA0 & 0x3F; // already combined
byte B_2 = 0x04;
byte B_3 = 0x5B;
byte B_4 = 0xD4 & 0xE0; // already combined

int Pressure = (B_1 << 8) | B_2;
int Temp = (B_3 << 8) | B_4;

Serial.println(Pressure,HEX);
Serial.println(Temp,HEX);
}

void loop()
{
 
}

Output in HEX
Quote
2004
5BC0
252  Using Arduino / Project Guidance / Re: Robot arm problems with joysticks and base on: February 28, 2014, 05:17:16 pm
Well then it can be done like this.

See what the value is when it's untouched (Center value), then set a dead zone based on that value. It can be +-3 ( or whichever works for you) of the center value.

Now when the joystick reading is greater then the center value, get the maximum value read. So as you move the joystick forward, the maximum value should increase and stay there even if you return to center. Once you get the maximum value, store it. You can reset it once you pass the center value and start to go below it. At this point you can get the minimum value and start to calculate the difference of the two. The difference can be what moves the servo.
253  Using Arduino / Programming Questions / Re: Bit stuck on bit manipulations ? on: February 28, 2014, 04:58:54 pm
Your correct, in me being wrong, 0x3F = B00111111; I fixed them.
254  Using Arduino / Programming Questions / Re: Bit stuck on bit manipulations ? on: February 28, 2014, 04:26:51 pm
Yes, your right. It should have been. byte B1 = B00101100 & 0x3F; // 0x3F = B00111111;
Why is Octal even used anymore, it should just be binary, decimal and hex.
255  Using Arduino / Programming Questions / Re: Bit stuck on bit manipulations ? on: February 28, 2014, 03:48:12 pm
Ok so get a reading of the values before and after you change them, then  compare them to what you should be getting.

You might need to typecase the read value as ints then add them.
Pages: 1 ... 15 16 [17] 18 19 ... 197