Show Posts
Pages: 1 ... 21 22 [23] 24 25 ... 239
331  Using Arduino / Project Guidance / Re: voice based password protected safty room on: June 23, 2014, 09:17:31 am
What have you tried already? Do you have any code that you have worked on?

Quote
i have ardunio uno r3
hc-05 bluetooth module
dc motor
10 LED s
etc
The dc motor is easy but you need a driver or shield to use it. 10 Leds are easy too, but what does etc include? A washing machine, toaster, garage door . . . ?
332  Using Arduino / Project Guidance / Re: voice based password protected safty room on: June 23, 2014, 08:40:14 am
both the code and the App used in the video are provided in Steps 5 and 6.

Try them first then try to make your own. If you get stuck, post the code and any pictures and we will try to help you.
333  Development / Other Software Development / Re: playing with (out of) ranges to improve map() e.g. mapping to percentage on: June 23, 2014, 08:31:58 am
Yea, you could use the map function for this, but for something as simple as a percentage, the overhead is a bit more than needed.

This is all you really need.
percent = (analogRead(A0) / 1023) * 100; // 888 bytes(int)
percent = (analogRead(A0) / 1023.0) * 100.0; // 1516 (float)

percent = map(analogRead(A0), 0, 1023, 0, 100); // 1214 bytes
percent = map(analogRead(A0), 0, 1023.0, 0, 100.0); // 1346 bytes

I don't have an arduino here to test the precision, but I'm pretty sure the map functions will return the same results.
334  Using Arduino / Displays / Re: LCD Screen and joystick on: June 23, 2014, 08:11:12 am
Well you can use PROGMEM to hold the text and use the LCDs print function to display it. As I said, the more you have on the screen the slower it will be.

You can use a counter based on the value from the joystick and from that counter, you can show a group of text.

What kind of LCD are you using, there may already be a library that does what you want.
335  Using Arduino / Displays / Re: LCD Screen and joystick on: June 22, 2014, 08:05:51 pm
Technically it can be done, but one its not that easy and two because the drawing speed of these LCDs and arduino's processing time is so slow, it will be very choppy. Even more so if you have a lot of things on the screen.

What are you trying to scroll, text, images or both?
336  Using Arduino / Project Guidance / Re: LCD menu's on: June 21, 2014, 08:23:05 pm
Look at reply #10 again, what you need is a counter.
if(switchVar1 == 32) counter++;
You can then use this counter to cycle through the cases:
switch(counter)
{
 case 0: //do x
    break;

 case 1: //do y
    break;

 case 2: // do z
    break;
}

However if you want to have it as click and double click, then it's a little different because it would require timers.
337  Using Arduino / Programming Questions / Re: Convert amount received by the serial on: June 21, 2014, 09:40:38 am
Say you read in a 5, it's currently a char type so you need to make it an integer. To do this, you take whatever char comes in(preferably a digit) and subtract 48 or '0' from it. 5 as a char is 53, then subtract 48 and you get 5.

Now this is when you use (temp = temp * 10).
Temp is currently 0, so it looks like this: 0 = (0 * 10) + ("incoming char");
You add the 5 now. 5 = (0 * 10) + 5;

Ok now read in a '9'. Subtract 48 to give you 9.
59 = (5 * 10) + 9;

Add another char 8, subtract and now you have:
598 = (59 * 10) + 8;

If you keep reading in chars, it will keep storing them. Note an int is only so big, so if you go over 32767, you will start to get negative numbers. To fix this you can either make the variable temp "unsigned" or type long or even unsigned long.
338  Using Arduino / Programming Questions / Re: Convert amount received by the serial on: June 20, 2014, 09:13:52 pm
Technically it holds up to the simplest method, because regardless of what comes in, its going to get converted to an integer (or some form of an integer).

However, as Peter said it would be a good idea to check if what came in was actually a decimal, which would then require a little more though and so it would then be a simple method.

Code:
if(Serial.available() > 0)
  {
     char serial = Serial.read();
     if( serial >= '0' || serial <= '9' ) // only digits get converted
        temp = (temp * 10) + (serial - '0');
  }

@Gillard
Note: once the integer is used for it's purpose, it is best to set it back to zero
339  Using Arduino / Programming Questions / Re: Convert amount received by the serial on: June 20, 2014, 08:00:03 pm
The simplest method is
Code:
int temp = 0; // global variable

void loop()
{
  if(Serial.available() > 0)
  {
     char serial = Serial.read();
     temp = (temp * 10) + (serial - '0');
  }
/* . . . other stuff */
}
340  Using Arduino / Programming Questions / Re: Can the (if statement) have A counter on it? on: June 20, 2014, 03:45:06 pm
Have a second counter "cnt" keep track of the high to low transition and if cnt is greater than 10, then stop changing the state.
if(cnt <= 10)
{
.
.
.
}
341  Using Arduino / Programming Questions / Re: Getting a steady output on a 1602 LCD display on: June 20, 2014, 03:03:46 pm
The print function should be inside the IF statement.
Code:
if(outputOld!=outputL){
    outputOld = outputL;
    printBinary16(outputOld);
  }
342  Using Arduino / Programming Questions / Re: Problem with my code,HELP! on: June 20, 2014, 02:16:05 pm
What is it doing and not doing?

Added:
This here is no good. There is a library called NewPing, it is far better and more precise than the old style like your using. It should make things much easier for you.
343  Using Arduino / Programming Questions / Re: Why do I get stange value from this calculation ? on: June 20, 2014, 02:11:27 pm
Have you tried this too?
Code:
UPONT * (float(Vcc) /1024.0) * ( (float(R1_kOhm + R2_kOhm)/float(R2_kOhm)) * 1000.0);
344  Using Arduino / Programming Questions / Re: Incomprehensible serial monitor outputs after running this code. on: June 20, 2014, 01:47:48 pm
What is the baud rate in the code and serial monitor?
345  Using Arduino / Programming Questions / Re: Getting a steady output on a 1602 LCD display on: June 20, 2014, 01:16:18 pm
The library is no good, we can give you the code to add the delay in properly, but in the end, even that may not work.

EDIT:
The thing is, in the code I gave you, I added basically a lockout condition. This lockout checks to see if the data is the same or if it has changed and if it is different then it shows it. But even that did not work.


What needs to be printed, where and duration.
Pages: 1 ... 21 22 [23] 24 25 ... 239