Show Posts
Pages: 1 ... 128 129 [130] 131 132 ... 361
1936  Using Arduino / Programming Questions / Re: I am making my own library, but I don't know how to make array goes well. on: July 30, 2013, 11:09:11 pm
array issue is just a small portion of this project.

If you could make a Menu object that includes Menu objects then they would include menu objects that would include other Menu objects, etc till memory runs out.

Just to knock some of the rust off, you should make a number of the examples work even if the code seems familiar. if you remember coding then you know that close won't cut it.

In your IDE under File is Examples. Do and learn/relearn at least the following:
File->Examples->02. Digital->BlinkWithoutDelay
File->Examples->05. Control-> go through all of these to tighten yourself back up

Other examples;
Forget plain old Blink, it teaches the bad habit of using delay().
The rest, do what interests you or you have questions about. Some need extra hardware.

Everything that uses C++ String objects, convert to C char array strings.
If you never knew C strings (lower case s) then find a string.h tutorial on the web, if you lock yourself into using String objects then you won't get as much help when they start crashing your sketches. UNO has only 2k RAM, Leo 2.5k. String objects waste and shotgun your heap in RAM.
Here are the standard C libraries docs for AVR GCC that Arduino uses, including string.h:

1937  Using Arduino / Programming Questions / Re: Problem communicating one-way between XBee’s and then the PC on: July 30, 2013, 10:23:59 pm
You nees the XBee to be on seperate pins than the Serial UART.


With an UNO leave Serial (pins 0 and 1) for the USB to PC connect.

Connect XBEE to 2 other pins using the SoftwareSerial library:

Here's the reference libraries page:

And the standard libraries page:
1938  Community / Bar Sport / Re: How to control a cat with an Arduino on: July 30, 2013, 04:50:51 pm
Would the average long haired cat have a lower terminal velocity than the average short haired cat?

1939  Community / Bar Sport / Re: Electronic Drop Bear Disabler on: July 30, 2013, 01:22:00 am
Somehow I think that something that would keep one safe from drop bears could be even simpler.

1940  Community / Bar Sport / Electronic Drop Bear Disabler on: July 29, 2013, 07:56:06 pm
I don't know if it's a big problem any more but I'm given to understand that a lot of Australians have lost cousins and drinking acquaintances to the dreaded drop bears, though perhaps fewer than to various spiders, snakes, crocodiles, sharks and road warriors.

So I was thinking that perhaps an electronic device using a high frequency sound or some kind of wave perhaps enhanced by magnets could be carried that would cause the drop bear to not drop and if that at some minor price could be sold to save future cousins and mates from being lost to these vicious predators.
I think that with proper research and testing (a couple weeks in the bush might do?) you could almost guarantee that anyone carrying a functioning drop bear disabler would never be actually harmed by a drop bear. In fact the hard part might be proving that the device does not harm the poor drop bears beyond depriving them of food.

Who knows? I might be worth a grant!
1941  Community / Bar Sport / Re: "The Physics Problem" on: July 29, 2013, 04:19:54 pm
And where would you take the angle measure? Bike and rider tilt WRT each other, helmet tilts and turns. I leaned inside of hard turns and lifted the inside leg to let the peg fold up. Helmet always turning, I needed to keep awareness high.
What's your tire-patch angle on a high crown road as opposed to a low crown road? I once went into a T at 45 mph on a bike with low center stand and slid a ways on the crown with the back wheel off the ground before getting back on two wheels and continuing along my way. I was already letting off the throttle, the back wheel didn't torque me and it's the front wheel that keeps you up. A little instinct with a lot of practice behind it, just hang in there and such minor events won't end your happy day. My accelerometer and gyros are built-in and pre-wired.

1942  Using Arduino / Project Guidance / Re: audio audio app on: July 27, 2013, 11:33:42 pm
Ok, I'm looking into some dsp shields.  Do you think I might need a data logging shield?

I get modules instead of shields and wire them with jumpers. I got LC modules very cheap directly from the company. They take 5V (signal and power) and 3.3V power (might not have to but I jumper it) and work with the SPI and SD or SdFat libraries. You have to email LCTECH and ask how much for however many you want. I bought more than 10, there is a small shipping and PayPal charge. OTOH the same modules can be found on eBay and at DealExtreme for not a whole lot and DealExtreme takes credit cards.

I buy direct 1 or more of many modules from LC at a time so it's not a hassle for me. They do have VS1053 DSP modules for voice record and play but I wanted MP3 player capability which turns out needs a solder mod I don't dare try. I can't say if they work right off the bat for voice recording or about the quality but here's a blog on the mod to play MP3's from a member on this forum:

All the hacks below should work on Arduino with the SPI and SD or SdFat libraries.

You can make your own SD module pretty cheaply. One way is to get a full size SD adapter for micro-SD card and solder directly to the contacts. Hardest part is voltage-shifting from 5V to 3.4V (plus or minus .3V is okay) which isn't a big deal. If you run the AVR at 3.3V it's not needed at all. 3.3V will make an Arduino 5V pin go HIGH so no need to shift up from the card to the Arduino.

Lot of good breadboarding tips here, the "ghetto micro-SD socket" is about halfway down.
However; Tip 1, on my small breadboards the power and ground rails go full length.

This site shows one of those with level shifters on a proto-board. Did he even spend $5?
I would 'build' the resistors right into the wiring. That's what heat shrink is for, right?  smiley-twist

This one is neat but involves unnecessary work.
Instead of opening the connector and taking it off the cable then making a custom cable and clamping the connector back... why bother? The next connector down the cable has holes perfect to jumper or plug a male header strip into. What can I say? I use old floppy cables for wire buses, they have 34 lines and multiple connectors, just watch out for the one with the twist or cut it off. It still needs a few resistors or diodes to go 5V to 3.4V.
1943  Using Arduino / Project Guidance / Re: How to implement a software selectable pull down? on: July 27, 2013, 08:38:32 pm
Atmega has software selectable internal pull up resistors on the IO pins.
How (if possible) can I wire external pull down resistors so that I can enable/disable them via software?

You could do what justone states but it begs the question of WHY?

The software that would enable/disable the extra pin could even easier simply flag whether or not to read the original pin. Less parts used, less to go wrong.

Also reconsider using the pullup. It reads high until you pull it down through ground. It's safe and draws very little current from your 200 mA total.
1944  Using Arduino / Programming Questions / Re: HELP!!!! new to programming on: July 27, 2013, 06:35:44 pm
It would really help you to go through a number of examples you can find in your Arduino IDE. Learn to trace code line by line while picking up the language fundamental basics.

If you learn all of the Control Structures tutorials and Nick Gammon's tutorial linked below you should know enough to start off well.

The examples are also covered with more explanation on the Arduino site. Here are some links to bookmark, collect more as you go.

Arduino specific pages, the last is the reference for the standard libraries that Arduino uses.

This tutorial is maybe the most important you can learn to get started on real time code.

Here are two C/C++ tutorial sites, but more oriented to PC's than microcontrollers.
1945  Using Arduino / Project Guidance / Re: audio audio app on: July 27, 2013, 06:03:17 pm
You will do better with an audio board of some kind. Check carefully before you buy that it will do recording and playback and has detailed docs or you may end up frustrated.

1946  Using Arduino / Programming Questions / Re: Help with simple code for Makey Makey-like behavior on: July 27, 2013, 11:36:22 am
YES! LarryD, that was it! I have some experience with C++ (not much, and I'm totally new to Arduino).
It never even crossed my mind to double that line, even though I had doubled everything else. I guess it didn't jump out at me as being a variable.

What does MovingAvarageFilter do?

I'm not 100% sure, but the way I understand it: closing a circuit with one's body creates a lot of variation in the output, so MovingAverageFilter takes some sample readings and averages them to filter out the 'noise' and give more predictable behavior.

Thanks guys! I'm gonna expand this baby now to include 6 keys!  smiley-grin

From the look of the video it's either measuring conductivity or capacitance. My guess is the first.

1947  Using Arduino / Programming Questions / Re: Help with simple code for Makey Makey-like behavior on: July 27, 2013, 01:11:39 am
What does MovingAvarageFilter do?
You have both sensors contribute to one moving average, there should be one output.
1948  Using Arduino / Programming Questions / Re: Check if some of the buttons was pressed while executing a "for" loop. HELP! on: July 27, 2013, 12:56:33 am
If you want to make a program, write it twice and throw the first copy away.

1949  Using Arduino / Programming Questions / Re: How to make arduino do 2 things at once on: July 26, 2013, 05:35:58 pm
Be sure to go to Nick's link. It is the best starting tutorial I know on doing more than one thing at a time. You will know why as well as what and how. of those moments.  My newbiness couldn't overcome currentMillis = 999 and previousMillis = 0xFFFFFFFF.  But I see it now.  My apologies.  Thank you for the patience.

Yes, the bits. Takes time to learn but well worth it.

HEX is base 16. 1 hex digit can be decimal 0 to 15 as hex 0 to 9 or A to F where A=10, F=15.
But the bits, there are 4 and with practice it's easier to read hex than binary.

bits high to low = 8 4 2 1 so binary 1111 = 1x8 + 1x4 + 1x2 + 1x1, binary 0011 = 1x2 + 1x1.

0 0000  0 --- 0x0 is no bits set
1 0001  1
2 0010  2
3 0011  3
4 0100  4
5 0101  5
6 0110  6
7 0111  7
8 1000  8
9 1001  9
A 1010 10
B 1011 11
C 1100 12
D 1101 13
E 1110 14
F 1111 15 --- 0xF is all bits set

If you run Windows, open the calculator and under View change it to Scientific.
You now can switch between HEX, DEC, OCT and BIN. In HEX the A to F keys are active.

Every text character is 8-bit ASCII, even the unprintable ones. They all take 2 hex digits.

Once you know bits you can start to get into bit shifting and bit logic and do bit masking. With those you can change or read the pins on a PORT all at the same time in less than 1 millionth of a second. To get closer to the metal you need solder.

Just take care when shifting bits right (high to low). If the high bit (bit 7 of a byte or short, bit 15 of an unsigned int or int) is 1 then as the bits shift right, the new high bit will be 1. That 'fill' doesn't happen with left-shift, just right-shift.
1950  Using Arduino / Programming Questions / Re: Check if some of the buttons was pressed while executing a "for" loop. HELP! on: July 26, 2013, 02:08:10 pm
looks like you are calling rgb();
from within rgb()

There is the major problem. rgb() runs rgb() with no escape until the return addresses stack down to overwrite the heap (your variables) after a very long time.

The delay just slows it all down and keeps your code from noticing a pressed button.

Learning BlinkWithoutDelay from your IDE examples (can be reduced to 12 lines of code not counting the comments) is the first step in learning real-time code with Arduino. It's funny how hard less than 20 lines of code can be to follow.

Unfortunately if i dont write that down the rgb() will run only once after i press the button, i need it to keep running indefinitely until the button is pressed. The funny thing is that nothing solved it until now, may i give up? That can't be a impossible thing to achieve right?

It is very possible to run rgb() over and over but that leaves you with the next big problem which is button (control) response. Do you want to have to wait for rgb() to finish and have the button pressed for the tiny fraction of a second before rgb() runs again? Or do you want to be able to press a button and get 'instant gratification' ?
Pages: 1 ... 128 129 [130] 131 132 ... 361