Show Posts
Pages: 1 2 3 [4] 5 6 ... 231
46  Using Arduino / Programming Questions / Re: LED Color fade based on time of day on: September 10, 2014, 11:24:47 pm
Break your project into more manageable parts:

Get the LEDs to fade. Then, get the time of day to print. Then start combining the code. If you want people to help with specifics in the code, you'll need to post what code you have so far and describe the specific problem you're having.
47  Using Arduino / Programming Questions / Re: Programming Help. Dice game. on: September 10, 2014, 11:21:42 pm
Remove all the unnecessary white space that is a major distraction, and re-post your code.
48  Using Arduino / Project Guidance / Re: Push button timer and LCD readout sketch needed on: September 10, 2014, 11:18:45 pm
What kind of people are on this board with their holier than thou attitude if this is a board to help people, for free, not financial consideration?

I think you're missing a major key word there: help. People here are more than willing to help others. You didn't ask for help with the project you asked for someone to post code that does what you want, be it from an example or a sketch that they "whipped up" for you. Maybe that's your definition of help, but that's not the case around here. It looks like nobody has an example sketch that fits your needs. Since you're can't "write code", it looks like you're at an impasse.
49  Using Arduino / Programming Questions / Re: callback actions/functions? on: September 09, 2014, 11:13:53 am
Thanks.


In the above example I don't see anything that looks like s1->

What does that part of the menwiz code do?

-> is short hand for referencing a pointer and accessing a member variable. The code you're looking at has an object pointed to by "s1". The object it's point to has a member function "addVar"
50  Using Arduino / Programming Questions / Re: callback actions/functions? on: September 08, 2014, 07:02:04 pm
Are there more examples than the two included in the library?

Google "function pointers"
51  Using Arduino / Programming Questions / Re: Serial read problem on: September 07, 2014, 06:56:10 am
I think you should do done reading on the post-increment operator. That will answer your first two questions. For the third, using char c allows you to not have to put the backslash in the array.
52  Using Arduino / Programming Questions / Re: Three node Zigbee network Programming in Arduino on: September 07, 2014, 06:50:35 am
On the sender, you send an identifier of '1', but on the receiver, you check the value against 1. '1' and 1 aren't the same value.

You also don't read the second byte if the identifier doesn't match. That will cause it to get it off sync very fast.
53  Using Arduino / Programming Questions / Re: How to add new output LED with CC3000? on: September 04, 2014, 10:41:42 am
Code:
         reqsub = req.substring(6,8);
          if (reqsub == "of"){
            digitalWrite(controlLED, LOW);
          }
          if (reqsub == "on"){
            digitalWrite(controlLED, HIGH);
          }
          if (reqsub == "off"){
            digitalWrite(controlLED1, LOW);
          }
          if (reqsub == "onn"){
            digitalWrite(controlLED1, HIGH);
          }

You're getting a substring of length 2 and comparing it to substrings of length 3. Change "off" and "onn" to something with only 2 characters.
54  Using Arduino / Programming Questions / Re: help with re writing a bit of code on: September 03, 2014, 06:03:15 pm
Apart from formatting, am I on the right track with what I'm trying to achieve with this code?

No. Updating servoTime 360 times before it's value is pointless. If you want to replace a for loop + delay() combo with non blocking code, you have to get rid of the for loop and handle entry and exit points yourself, as well as taking care of the typical stuff for loops do (initialize a value, check a condition, change a value).
55  Using Arduino / Programming Questions / Re: help with re writing a bit of code on: September 03, 2014, 05:45:50 pm
Step 1 is to run your code through the Auto Format tool provided by the Arduino IDE (Ctrl + T is the shortcut) before your post. This gets rid of funky indentation that causes headaches for those trying to read it and help.

Code:
void loop()
{
while(digitalRead(pirPin) == LOW);
}
if ( (millis () - pumptimer) >= pumpinterval){
     togglePump ();
}
if ( (millis () - servotimer) >= servointerval){
     toggleServo ();
}

Please refer back to PaulS's point:

Quote
All code needs to be in a function, except for variable declarations.

Code:
   for(svrPos = 0; svrPos < 180; svrPos += 1){  // 0  to 180
    myservo.write(svrPos); // servo to variable 'svrPos'
  servotimer = millis (); 
  }

99% of the time, when someone with a for loop and a delay tries to switch to a non-blocking approach, the for loop has to go. You aren't lucky enough to be in the 1%.
56  Using Arduino / Programming Questions / Re: Storing Fractional Number on: September 03, 2014, 05:38:14 pm
but i want to store only four digits after point

Multiply it by 10^4 and store it in an int or a long.

Depending on what you're doing with it, though, you may just be wasting your time.
57  Using Arduino / Programming Questions / Re: Illogical Type Changing on: September 03, 2014, 05:05:19 pm
I think this causes from IDE

The IDE doesn't compile code, so I don't see how that's possible.
58  Using Arduino / Programming Questions / Re: Storing Fractional Number on: September 03, 2014, 05:00:23 pm
I just tried to use "Float" , but it stores only two digits after point .

Incorrect. It stores a lot more than two digits. You're likely only seeing two digits because that is the default number of digits printed by the stream class.

See here: http://arduino.cc/en/Serial/Print

Quote
An optional second parameter specifies the base (format) to use; permitted values are BIN (binary, or base 2), OCT (octal, or base 8 ), DEC (decimal, or base 10), HEX (hexadecimal, or base 16). For floating point numbers, this parameter specifies the number of decimal places to use. For example:
59  Using Arduino / Project Guidance / Re: Xbee networking help???? on: September 03, 2014, 03:51:40 pm
Thx for reply.But how can i do that?

You have to come up with a protocol. A simple one would include a start byte, delimiter and stop byte. Anything between the start byte and deliminator is the "address". Anything between the delimiter and the stop byte is the value. Example:

Code:
"<1:123>"

The  '<' and the '>' are the start and stop bytes, respectively. the '1' is the address. the ':' is the delimiter. The "123" is the value. Since it's ASCII encoded, you'll need to use something like atoi() to convert the values into actual numeric values.
60  Using Arduino / Programming Questions / Re: why error msg "Some files are marked \"read-only\"... on: September 03, 2014, 11:32:47 am
This typically happens when you try to save a sketch inside the examples folder. Where are you saving these sketches?
Pages: 1 2 3 [4] 5 6 ... 231