Show Posts
Pages: [1] 2 3 ... 87
1  Using Arduino / Project Guidance / Re: LED controller zones on: August 14, 2014, 01:28:57 pm
You can use two wires to simulate a button. Join them - button pushed. Seperate them - button un-pushed. smiley-cool

can you run a loop to send signals to an LED strip while at the same time selecting which program
Yes of course you can do that. There is almost no limit what you can do with the software logic as long as the timing is not too critical or short. Anything that involve blinking lights, buttons pushed by humans is dooable. Look at the avreage 3D printer. It reads an SD card with instructions, pulses the steppers, monitors the temperature, end stop switches and if not using a SD, monitors the ASCII input for the next command. (Yes, I wrote such a  program from scratch.)

Somewhere in here i worte a similar example some time ago. (damn the limited search facility). This item is not what I am thinkimg of, but it might help you see the way forward.
2  Using Arduino / Project Guidance / Re: LED controller zones on: August 13, 2014, 04:04:49 pm
Yeah, that was what I was afraid of.
How to change a variable after it's been defined
Of course, that is really Programming and not a Project Guidance?

int a = 7 ;  // defines and gives the variable an initial value (before setup or loop runs)

inside setup(), loop() or your own functions:
  a = 13 ;  // "change a variable after it's been defined"

Now if the above was too simple, then appologies for misunderstanding your question, and carry on with the text below. If that was revealing, then you first need to understand "basic programming" way before you cut-n-paste more code pieces or "combine" them.

The problem you pose is the same whether we are talking about "zones" (whatever that was, did not understand your explanation) or just a simple LED. Likewise buttons or "LCD as a Pushbutton". I guess you are using a "standard" LCD/pushbutton unit with accompaning library.

Suggestion to you: Get your Arduino, hook up a few LEDs (each with a resistor) and a few buttons (connecting the Arduino pin to GND when pressed - set the pin to INPUT_PULLUP). Now you have an enviroment to exercise your programming skills and when that works you can wire up your Zones and LCD and all that. Create projects in small steps.

The first programming exercise should be a Push-On Push-Off functionality. (there is a minor challenge that you need to debounce the button. The simpleminded way is with delay, the correct way is with a timer. The former will work "well enough" for what you have explained, but will bite you if/when the project includes more stuff). 
3  Using Arduino / Project Guidance / Re: Controlling ESCs on: August 13, 2014, 12:50:27 pm
If you did not get some paper or documentation with your stuff, then you can guess, guess, guess ... or you can use use google with the type number, type name and anything else on the label. Unless there is somelese here with those exact same controllers that knows.
4  Using Arduino / Project Guidance / Re: LED controller zones on: August 13, 2014, 12:43:23 pm
What code have you written so far (you write "the program that is currently running")? Or what example are you wondering how to modify?
Show the code, show the code....
5  Community / Exhibition / Gallery / Re: Bathroom fan control on: August 06, 2014, 01:17:06 pm
The thing with millis(), long or not long, rollover problem is that after 52days continously, it will roll over.
That will render your sketch useless for 52days.

The way to deal with it is that your millis can can never be less than your previous stored millis.

If that happens you just make them equal.
Rubbish. smiley-yell

If you use unsigned variables and do the subtraction the "rollover" problem does NOT EXIST.

Here is a post where I have a longer explanation.  ->

And back to the posters next question (inspired by janost's FUD)
Is there any way of "speeding up" millis to test the rollover?
You can use unsigned integer for all "timer variables". Use word(millis() ) to get current value. Now you get the rollover every 65.536 seconds. So you test program should have timers at 10 seconds duration or so. (Otherwise you may fall into the trap and confusion of timers "auto retriggering" as described in my longer explanation above)
6  Using Arduino / Programming Questions / Re: Operator bitshift on: July 31, 2014, 08:01:12 am
"all the RAM" ? No not really.

"A << 5" is an expression. It returns whatever A contained leftshifted 5 times (which is (almost) the same as multiplying by 32).

If A is a byte and it contains B01000000 then the result will be 0, as the "1" fell off the end.
If A is an int and thus contains B0000000001000000 then the result will be 0000010000000000
If A is an array, A << 5 is illegal (it may do an address expression, but it will NOT move all elements of A) but A[1] <<5 makes sense.

Either way, "A" does not change, it is just an expression, you need to put the result somewhere:
B = A <<5 ;
A = A << 5 ;
7  Community / Exhibition / Gallery / Re: Bathroom fan control on: July 31, 2014, 07:49:11 am
"timer" variables should be
unsigned long previousMillis = 0;        // will store last time LED was updated
Then the magic works - there is no problem with "overflow" - you have written the code right
if(millis() - previousMillisLed > interval) {
8  Using Arduino / Programming Questions / Re: int to byte conversion on: July 28, 2014, 11:59:21 am
(Crossroad asking a question - must try and answer !)

Cant think of anything faster. With a little carefull programming not take much more then 20-50 instructions... or about 20 uS meaning it will take less than a thousandth of your 3 ms time window.

If for some reason yu are stuck by extreme time problem, you could rewire your output circuitry so the ints map better, ie the redunant bits are ignored (I presume we're talking a set of shift registers here)
9  International / Scandinavia / Re: Power supply - mega on: July 27, 2014, 03:04:29 pm
Ja, og skillnaden er at der en diode i BarrelConnectoren (om du nu har en strömforsyningen som har - i mitten). Men det har VIN inte så akta akta. (Den har det inte før at man kan ta ut like bra som sätta in ström på Vin).
10  Using Arduino / Project Guidance / Re: G Code on Arduino? on: July 24, 2014, 03:23:49 pm
I agree with both of you, and maybe not.

Gcode in the 3D printer (or CNC etc) masks the interal workings of the device (turns/mm stuff, postive end stop), yes.

However most slicers need to know much of the printer anyhow in order to generate a good Gcode. F.eks. "retract head slightly and the filament when moving to another section" Here the slicer generates several lines of Gcode to do something that should be internal. Also the slicer needs to know which dialect of Gcode the printer can cope with. (In fact I know of at least two equally used modes of comments - one where the line starting with # is a comment and one where enclosing text in round brackts is a comment. So much for Gcode standard....)

On the other hand when spooling a print of an SD card, you can adjust some running parameters (like the speed) on the fly, as these are below the Gcode layer. Well, may be that could be done with a lower-level software, too.

I notice that programs like Mach3 which control the steppers directly also take Gcode as the input from some other program.

But the biggest motivator is probably TRADITION.  "because that is how we always have done it".
11  Using Arduino / Project Guidance / Re: 3x3x3 LED Cube Malfunction on: July 24, 2014, 02:58:17 pm
( @spycatcher2k There is an #include - seem OK to me )

WireEverywhere - You wrote
I tried to upload the code below but there was something wrong with it
What - it displayed the Pong game instead? Or did the upload fail (no program uploaded at all)

In other words - what was not working / displaying as you expected? You must state What you hoped would happen (and why, ie. what did you do) and what actually happened.

You also write
There are four LEDs in the bottom row that are very bright compared to the other led's
Well, could be your wiring, could be a bad transistor, could be the program. Now you did include the code, but please also include the cube library you are using, so we who are trying to help do not first have to find it (and possibly find a differnet version)

Which brings me back to the first question - apperently some LEDs are lit up, but is it displaying some apttern or is that just a static display ... or an artifact from a previous uploaded unrelated program
12  International / Scandinavia / Re: Power supply - mega on: July 24, 2014, 12:12:16 pm
Sæt 7V (eller op til 12V) på strømstikket.
Brug en 5V forsyning (eller lidt mindre er også OK) og sæt det på 5V pinden.
Der er et kredslop som sørger for at den skifter hvor den tager strøm fra når du hiver USB pinden ind/ud.
13  Using Arduino / Programming Questions / Re: Splitting an integer into its digits - floating point/rounding/conversion error? on: July 14, 2014, 03:17:52 pm
pow() is a function returning floats. Float operations are not exact. Ie when doing something where the answer "should be" 100.00", a float operation may return 100.000001 or 99.9999999. That is what (propably) is happening in your case. The int( ) opertion which is converting to integer mey do a truncate rather than a round. Your spreadsheet is more forgiving (having been written for use by  not-so-computer-science-minded customers).

Choose a differnet algorithm. For example use number %10 to get the last digit. Then reduce number by dividing it by ten, that way the last digit is now what whould be the tens.
14  Using Arduino / Programming Questions / Re: boolean doesn't response on: June 29, 2014, 04:58:34 am
@HugoPT - follow the git link he provided - extensive explanation given there.
15  Using Arduino / Programming Questions / Re: boolean doesn't response on: June 29, 2014, 04:44:06 am
By "stupid" holmes4/Mark means that you only show the code that sets GoToServo to false. Thus, as we can not see any code that sets it to something else, the code snippet is working exactly as it should.

Show all the code that makes changes to GoToServo. If you want to reduce the code posted, then you can exclude functions that make no change GoToServo (F.ex. I do not see the significance why you included the ServoMovement1() code. It does nothing as far as your problem is concerned )

BTW, the print does not "convert" a boolean type to a printable representation, it shows the (interal) value. You may want to replace it with
Pages: [1] 2 3 ... 87