Show Posts
Pages: 1 ... 13 14 [15] 16 17 ... 196
211  Using Arduino / Programming Questions / Re: Multiple buttons/inputs how to? on: March 03, 2014, 04:57:36 pm
Sloppiness aside, what should the break, left and right sequences look like?
212  Using Arduino / Project Guidance / Re: Back Space and Enter operation on: March 03, 2014, 12:50:00 pm
This here is a function I made for my password library that allows the person to clear what they entered, one entry at a time.

The parts that are lined out are not important for you to know what they are at this point.
Quote
char * NewPasswordV2::EnterData(char data)
{
   if(data > 0 && data != _CLR && data != _ENT)  //look at incoming char, see what it is. _CLR = 'C' on my keypad, _ENT = 'E'.
   {
     nt[cnt] = data; // If incoming char is not 'C' or 'E', store it.
     cnt++; // increment counter (index) for next char
   }

   if(data == _CLR) // if incoming char is 'C'
   {
     nt[cnt] = NULL; // clear the entry at the current index
     cnt > 0? cnt-- : cnt = 0; // if cnt > 0, meaning there still is something in the array, decrement the index for the next new char.
   }

   if( (_MODE? data == _ENT : cnt ==Lenght_of_Passwords - 1) )
   {
     checkFlag = true;
     cnt = 0;
     return nt;
   }

}

What you can do is pass in your arrays, UL and LL as pointers or the whole array and basically do what  I did here.
213  Using Arduino / Installation & Troubleshooting / Re: When I Try To Upload Something There Is No Upload Button. on: March 03, 2014, 11:41:08 am
Did you remember to choose the board your using and the com port its on? Post a screen shot please.
214  Using Arduino / Programming Questions / Re: RGB LED, random colour generator not working on: March 02, 2014, 11:36:13 pm
I think you would need to attach the legs of the LED to the PWM pins and use the analogWrite() function because the digitalWrite() function only turns pins on and off. I may be wrong.

No, your correct, I didn't' see what pins he was using, my error.
215  Using Arduino / Installation & Troubleshooting / Re: When I Try To Upload Something There Is No Upload Button. on: March 02, 2014, 09:07:27 pm
That's very strange, have you tried to re-install the software? What version are you using? CTRL+U is the keyboard shortcut, see if that works, if not the re-install the software.
216  Using Arduino / Programming Questions / Re: RGB LED, random colour generator not working on: March 02, 2014, 07:50:51 pm
Make sure your button is wired normally LOW with a resistor to ground (not floating), and your button will need to be debounced, or able to prevent from being held down.

You can fill in the rest and make currState, lastState boolean at the top of the sketch.
Code:
currState = digitalRead( 2 );
if( currState != lastState)
{
  lastState = currState;
  if(currState == HIGH)
  {
    // get colors here
  }
}

Tip, if you know certain variables are not going to exceed  (-32,768 to 32,767) = int or (0 to 65,535) = unsigned int, you can make them a byte to save memory. Oh and analogWrite, not digital.
217  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.
218  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.

219  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.
220  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.
221  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.
222  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
@
223  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.
224  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?
225  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?
Pages: 1 ... 13 14 [15] 16 17 ... 196