Show Posts
Pages: 1 ... 90 91 [92] 93 94 ... 230
1366  Using Arduino / Programming Questions / Re: expected unqualified-id before 'if' on: June 09, 2013, 01:19:41 pm
sorry I am a newbie. So how do you put it in a function (i'm dutch and 12 years so sorry for my english)

Assuming you don't have to return a value:

Code:
void someFunctionName()
{
  // code goes here
}

Assuming you do have to return a value (int in this example:

Code:
int someFunctionName()
{
  // code goes here
  return someInt;
}
1367  Using Arduino / Programming Questions / Re: How do I set different outputs along a Senors values like a to b, c to d, etc on: June 09, 2013, 01:18:13 pm
I'm assuming you have to use map function but not sure how to set this up.

Only if there exists an equation that can take the unmapped value and make it into a mapped value. If you had a subset like this:

1 -> -4
2 -> 8
3 -> 1000
4 -> -2345
5 -> 1

then the map function won't work. In cases like this, you would need an if/else if or an array.

You would be better off posting more information, like the code you have currently and a better description (including examples) of what you want to do.
1368  Using Arduino / Programming Questions / Re: expected unqualified-id before 'if' on: June 09, 2013, 01:13:37 pm
it still doesn't work

error: expected unqualified-id before 'if'


Post the updated code, so we know you did it right.

how do you make the if statement in a function?

You don't, you put it into a function.
1369  Using Arduino / Project Guidance / Re: Serial Error Reason ? on: June 09, 2013, 12:56:49 pm
if that's the case, then nothing happens either ways ( according to plan ) .

Yes, but you are assuming something does happen when you try to process the data you received here:

Code:
getSerial();
trueval = serialData * 100 ;
getSerial();
trueval = trueval + serialData * 10 ;
getSerial();
trueval = trueval + serialData ;

The improper way to do it would be to make getSerial blocking until data has been received. The proper way to do it, is to not act on data until some kind of terminating byte is sent.

Also, are you returning serialData when it is a global variable?
1370  Using Arduino / Project Guidance / Re: Push-Button LED help on: June 08, 2013, 11:25:24 pm
Post your code.

Post a description of how things are connected.
1371  Using Arduino / Programming Questions / Re: Two characters(char) from serial monitor in the one field of the matrix-Problem! on: June 08, 2013, 11:18:19 pm
Read one character. Convert it from ASCII to binary. Store it in a variable. Shift the contents of the variable to the left by 8. Read the second character. Convert it to binary and add it to the variable:

Code:
char h = 'F';
char l = 'F';

int r = hexASCIItoBinary(h);
r <<= 8;
r+= hexASCIItoBinary(l);
1372  Using Arduino / Programming Questions / Re: HOW DO YOU USE BUTTON TO SWITCH BETWEEN 4 SEQUENCES on: June 08, 2013, 11:11:27 pm
Take a look at the BlinkWithoutDelay for writing non-blocking blinking code.

Take a look at the StateChangeDetection example for handling button toggling.

Create a state machine in which the state is changed based on the momentary switch being pressed/released. The state will determine which LEDs blink.

Don't try to get everything working at once, get a small part working. Study it to the point where you understand it. Then, add another feature. Rinse and repeat.
1373  Using Arduino / Programming Questions / Re: Stringreplace() function on: June 08, 2013, 10:11:04 am
With zoomkat code I can add serial data to a string. So what I have to do to parse floats from created string?

Ask zoomkat. S/he is the only regular around here that recommends using Strings.
1374  Using Arduino / Programming Questions / Re: Demo sketch wnt compile on: June 07, 2013, 05:20:06 pm
Yes tried the correct screen examples,get compile errors too

Post the full code of the example, using CODE tags.

Post the full error message.
1375  Using Arduino / Programming Questions / Re: Demo sketch wnt compile on: June 07, 2013, 04:03:14 pm
On arduino ide press file then sketchbook or libraries

So are there any examples that came with the library? Have you tried to upload those?
1376  Topics / Home Automation and Networked Objects / Re: Replacing UNIT_x with variable on: June 07, 2013, 03:49:47 pm
oh my God...
I put quotes on my values!

Good example of why copying and pasting your whole code from the start is the better than posting from memory, or assuming what the other person posted is what your wrote into your code.
1377  Using Arduino / Programming Questions / Re: Demo sketch wnt compile on: June 07, 2013, 03:48:16 pm
Its shows UTFT and subfolders for demo's for differnt screen but not libraryName.cpp and libraryName.h

What shows that?
1378  Using Arduino / Programming Questions / Re: Demo sketch wnt compile on: June 07, 2013, 03:28:53 pm
The sketch he sent me is at the top of the post as a text file i just copied and pasted into arduino ide as he instructed

If you're referring to the code in your first post, it still requires a library to be properly installed.
1379  Using Arduino / Programming Questions / Re: Demo sketch wnt compile on: June 07, 2013, 03:23:53 pm
   The seller did say just run that code and the demo will run on the screen just to show the screen working as the 1st 1 he sent didnt work which when i returned and he tested with that code didnt work, so sent replacement,now using it,which he tested before shipping, worked ok,but i'm the noob struggling to even compile the demo he sent.

Since I have no idea what he sent you, I can't speak to that.

Quote
  So if i open sketchbook folder, add a sub folder named libraries and put the UTFT Library in there??

Yes. It should look something like this:

Code:
<SKETCHBOOK>
  libraries
    libaryName
      examples
      libraryName.cpp
      libraryName.h
      keywords.txt
      ...
1380  Topics / Home Automation and Networked Objects / Re: Replacing UNIT_x with variable on: June 07, 2013, 03:21:03 pm
Post your full code and full error message.

The following:

Code:
#include <x10.h>
#include <x10constants.h>

byte devices[]={
  UNIT_1, // dining room
  UNIT_2, // front outside
  UNIT_3, // back deck
  UNIT_4, // stairs up
  UNIT_5, // front window
  UNIT_6, // hut
  UNIT_7, // back garage
  UNIT_8, // entrance
  UNIT_9, // Stairs down
  UNIT_10, // basement ceiling
  UNIT_11, // basement lamps
  UNIT_12 // basement over TV
};

void setup()
{
 
}

void loop()
{
 
}

Compiles just fine for me.
Pages: 1 ... 90 91 [92] 93 94 ... 230