Show Posts
Pages: 1 2 3 [4] 5 6 ... 67
46  Using Arduino / Programming Questions / Re: How to pass variable to library? on: May 08, 2013, 08:51:43 am
For a working example, take a look at bitlash.cpp and bitlash.h here:

It would help to see B.cpp and B.h to confirm the syntax is correct etc.


47  Using Arduino / Programming Questions / Re: How to pass variable to library? on: May 08, 2013, 08:28:08 am
You also need to declare your new variable in the library's .h file.

As Paul says, you are trying to accomplish A and asking us about C.  It would be nice to know A and B.

48  Using Arduino / Programming Questions / Re: How to pass variable to library? on: May 08, 2013, 06:53:45 am
The library can't see your sketch's globals.  That's why you get the error.

You can add a global to the library, which then your function can see.

Or you could add an additional argument to a library function and pass the boolean in that way.

49  Using Arduino / Programming Questions / Re: A quick question about delay... on: May 07, 2013, 08:18:59 pm
Without the delay, your analogWrite stays in play for only a few microseconds at most before your digitalWrite shuts off the LED.  Way too fast to have any visible effect.

With the delay, you have the analogWrite engaged for many pwm cycles, which conveys the proper visual effect.

50  Using Arduino / Programming Questions / Re: Random messages in serial monitor on: May 07, 2013, 05:06:40 pm
This is very creative, but it's not your grand-daddy's C:
  Serial.println(receiverRight + "" + receiverLeft);
Try printing the ints separately with a blank between them.

51  Using Arduino / Programming Questions / Re: Can't send a file through sd card to serial port. on: May 07, 2013, 02:45:03 pm
The number 1 when sent through the serial monitor is actually the ascii character '1', which has the value of 49 .

Test for '1', not 1.

52  Using Arduino / Project Guidance / Re: please help me im going crazy. on: May 07, 2013, 11:01:37 am
Is this the line before the first error?
char keypad.addEventListener(keypadEvent); //add an event listener for this keypad

What is the purpose of that 'char' there?

53  Using Arduino / LEDs and Multiplexing / Re: blink-without-delay slowing things by factor 10 ? on: May 06, 2013, 06:54:32 pm
Wondering: Did you really intend to use micros() here?

   unsigned long currentMillis = micros();   

54  Using Arduino / Project Guidance / Re: How to pass char arrays to methods on: May 06, 2013, 03:33:12 pm
This code passes a char array to the Serial.println function:
char foo[] = "Hello, world!"

What are you trying to do, and what is the problem?

55  Using Arduino / Project Guidance / Re: more than letter on: May 06, 2013, 12:19:00 pm
C array indexes start at zero.  Your c[3] array has three elements numbered [0], [1], and [2].


Moderator edit:Smileys disabled
56  Using Arduino / Programming Questions / Re: How to flush receiver buffer, on: May 06, 2013, 07:36:31 am
This is a frequently asked question.  Clearing the input buffer is simple to do, but it is never a good design choice.

I can not figure out how to keep extraneous characters out of the buffer I an reading the string to.

There are two approaches that work: 1. Don't send them.  Or, 2. Consume them properly as they are sent.

Needing to clear the buffer is a sure sign of a design issue elsewhere, which we can help you with if you post your code (in code tags, please).

Good luck with your project,

57  Using Arduino / Project Guidance / Re: Newbie needing help on: May 06, 2013, 07:01:27 am
code just looks like a mine field for at the moment
I'm sure it does, and this is exactly the point.  Part of the learning is training your eyes to spot the patterns in the code.  (Which is why reading poorly formatted code is painful to an experienced coder with code-friendly eyes.)

Find a good tough piece of code and read it every day for a few days and you'll understand much more of it.  Dig in on the parts you don't get and they will yield to effort.  (And if you have a specific question you can always ask it here - the forum is optimized for that.)


58  Using Arduino / Project Guidance / Re: Newbie needing help on: May 06, 2013, 06:28:29 am
In my view, the best way to learn fast is to read a lot of other people's code.  You won't necessarily understand it all, at first, but that's good, and easily fixed with google.

You can find a lot of code here on the forum and playground, and don't overlook GitHub where some of the bigger projects live.

Just my two cents.  Good luck with your learning process.


59  Using Arduino / Programming Questions / Re: Cannot send string to void on: May 05, 2013, 08:53:27 pm
Sending String to the void, now that would be an idea.

60  Using Arduino / Project Guidance / Re: Scheduling cooperative tasks waiting on a delay. on: May 05, 2013, 08:27:19 pm
This library replicates the task scheduler from Bitlash for Arduino C functions:

Simple non-pre-emptive round-robin scheduling seems to be tunable to more or less work in most of the cases I've seen. 

But I wouldn't expect to run a lot of 5-20 ms tasks.  In Bitlash, the keyboard response stays pretty lively until the fastest intertask interval goes below about 50ms.  Simple tasks (in Bitlash) run fine down into the 10-20 ms range, at which point you're basically running the task every time through the scheduler.

Pages: 1 2 3 [4] 5 6 ... 67