Show Posts
Pages: 1 ... 9 10 [11] 12 13
151  Using Arduino / Programming Questions / LoLShield library on: January 26, 2011, 01:16:33 pm
I picked up an LoL Shield, figuring it'd be an educational experience, at least as far as programming it goes. I've got the basics of programming an Arduino down, and feel like I'm ready to move forward with the more complex things, one step at a time. Anyways.. I installed the Library and loaded up the example sketches.. There are no comments anywhere in the code explaining what's going on or why..
Here's an example (I cut out the header on top to save space in this post, no offense intended), this is the "fonttest" sketch that scrolls text on the display:
#include "Charliplexing.h"
#include "Font.h"

#include "WProgram.h"

/* -----------------------------------------------------------------  */
/** MAIN program Setup
void setup()                    // run once, when the sketch starts

/* -----------------------------------------------------------------  */
/** MAIN program Loop
void loop()                     // run over and over again

char test[]="HELLO WORLD   !     ";

    int8_t x=0,x2=0;
  for(int8_t j=13;j>-100;j--) {
    for(int i=0;i<17;i++) {
      if (x>=13) break;

The comments that ARE in it are remedial.. heh.. Questions I have are like what on earth is "int8_t", I've never heard of that before, I don't see it mentioned in the Arduino programming guide anywhere. Why does j start at 13 and appear to go to -100? The "break" in the middle of that loop is confusing, why is it breaking out? It's a really short program, it should be really simple, but without comments, I can't even change it to display a longer string of characters. Heck, a simple note of "// This string must be all uppercase" wouldn't have hurt.. heh.. I know I'm being a bit of a whiner, I just think the example sketches should be HEAVILY commented because they're meant to be educational.
Also, if someone downloads the LoLShield library to have a look, the Tetris sketch in it won't even compile, it says:
tetris:21: error: ISO C++ forbids declaration of 'pos_t' with no type
So if someone who knows what they're doing could look at that one too.. I imagine it used to work with an older Arduino IDE, but doesn't work with 022 anymore?
152  Using Arduino / Motors, Mechanics, and Power / Re: Interfacing multiple TIP120's with PWM on: January 26, 2011, 01:05:26 pm
I don't see any resistors in your diagram. You should have a resistor (1k should work fine) between the Arduino pin and the Base of the TIP's.. That'd be pin 1. The Collector (pin 2) should go to the negative side of the bulbs, positive side goes to your battery, you didn't label your battery, but I assume you have that part right. Emitter (pin 3) goes to ground, which I see you've joined the source battery ground with the Arduino. That is the correct way to do it. So if you have the pins right, and the resistors installed, it should work. smiley
153  Forum 2005-2010 (read only) / Forum / View my posts on: December 21, 2010, 11:19:55 am
Is there any way to view the threads I've previously posted in? Specifically, the ones that have gotten replies since my last visit. I find it very hard to track down those threads when I come back. Other forums I'm familiar with have a "View Your Posts" and the ones with replies will be at the top, or the Control Panel front page will list your threads with replies since the last visit.
154  Forum 2005-2010 (read only) / Development / Re: Frequency in, modify, Frequency back out on: January 21, 2011, 12:15:05 pm
That makes sense. Thanks for the tips, gives me a good direction to look in. smiley
155  Forum 2005-2010 (read only) / Development / Frequency in, modify, Frequency back out on: January 20, 2011, 09:53:29 pm
I'm still a newb, so let me start with what I'd like to do, and then I'll move onto my guess as to how I need to do it (it's a real rough guess..)
What I want to do is read in a frequency, divide that frequency by 1000, then multiply it by a user definable amount, something like 923, and then output the new frequency on another pin.
Both the incoming and outgoing signals would be a fixed 50% duty cycle. The frequency would be between 2hz and 200hz, I'd prefer .1hz resolution on both the input and output.
I found a library that uses Timer2 to get the incoming frequency. Much of how it works is well over my head, but as I understand it, the timer just causes a recurring interrupt on a time specific table, so that you can accurately time the high and low input events on a pin. Do I have that right?
Now for the output, would I use Timer1? Can I use Timer1 and Timer2 at the same time? Or would I just schedule the output along with checking the input on the same Timer1?
I believe the kind of output I'd be doing at this point would be referred to as bit-banging, because I'd be manually changing the pin state based on the timer, rather than using a PWM output. Sounds like the PWM outputs are not what I need, because I only need 50% duty cycle, and the Frequency selection is very limited.
What am I trying to build? Electronic speedometer correction device.. If your tires are 7.3% too tall, put this in between the speedo and the speed sensor, and it'll correct the speed. It's an 8000pulse per mile sensor, so that's where I get the 2-200hz (2.2hz=1mph and 222hz is 100mph). If someone has already written something like this, point me to it please. smiley If there's a library for the kind of output I'm trying to get (something like an analogWrite(frequency) rather than analogWrite(duty cycle)) point me to that too.. smiley And if what I want to do is completely impossible with an Arduino, tell me that too.. smiley-wink hehe.. Thanks guys.
156  Forum 2005-2010 (read only) / Development / Re: Develop arduino without arduino (simulator?) on: December 29, 2010, 06:19:54 pm
I used virtual breadboard to prototype my code while waiting for my Arduino to be given to me on my birthday, earlier this month.. It was a PITA to work with, especially since it was windows only, so I had to run it in a VM. But it did allow me to do the testing I needed. I ended up going beyond what the program could do.. It must be based on a very early version of the Arduino language, there were several commands that it couldn't handle.And prototyping anything beyond LED's in it was too complicated for me.. heh.. (Heck, I spent a good 20 minutes figuring out how to add more LED's and move them around)  disclaimer: I didn't RTFM.
157  Forum 2005-2010 (read only) / Development / Re: Using Sleep mode when delaying on: December 22, 2010, 11:52:48 am
What if you created a pointer to the Sleeptime variable.. And your interrupt changed it to 0.. Would it wake up within 16ms of the interrupt occuring? smiley I like your code, it's way above my head though, as I'm just getting into the Arduino. I see you have comments all over that code, that's very helpful for understanding it. smiley
158  Forum 2005-2010 (read only) / Development / Re: Using Sleep mode when delaying on: December 20, 2010, 09:51:21 pm
Sleeping is good for saving power, right? Can a hardware interrupt (pin 2 or 3 if I recall correctly) wake it from sleep earlier than the delay you're setting?
159  Forum 2005-2010 (read only) / Development / Re: Arduino-based car alarm, remote locks/windows on: December 15, 2010, 07:21:53 pm
Fair enough. smiley
160  Forum 2005-2010 (read only) / Development / Re: Arduino-based car alarm, remote locks/windows on: December 15, 2010, 06:25:27 pm
I'm new here, but I must say, I'm really surprised at the bitter response you've gotten to your post. This IS the development section, not the Exhibition section, you'd think they'd be more forgiving of code that's still "in development"... Anyways.. I too was thinking about making a car alarm out of an Arduino. I've been installing car alarms professionally for about 10 years now. I'm intimately familiar with how they work, from the outside, and have a pretty good idea what I'd make the code look like on the inside to get similar behavior. I was thinking of pairing up an iPhone over bluetooth to control my car alarm unit. I'd probably go ahead and add remote start to it while I was at it.
Does anyone know off the top of their head how much current an Arduino without a serial chip onboard (assume I use an external FTDI or something along those lines) draws? I imagine a lot of it has to do with how efficient the 12v DC to 5v DC power supply is, but assuming I made the best one possible..? That's what I'd see as the dealbreaker. I believe you can have a draw of up to 40ma on the battery in a car before the battery starts to die really really fast. Less is obviously better, because the bluetooth module and other modules are going to draw some power as well.
As for the post about "just yank all the TTL wires and run them to 5v to defeat the thing".. I'm not sure how you think a normal car alarm works, but generally, this is how you'd defeat any aftermarket car alarm, simply unplug it. There are many installation techniques that can help prevent that from happening on a normal alarm, and I assume the same would be the case with an Arduino, right down to completely disabling the factory ignition switch and it's wiring, and replacing it with an RFID through the Arduino controlled system. Even that would still be bypassable, but the thief would need to be familiar with the exact custom contraption you created.
161  Forum 2005-2010 (read only) / Troubleshooting / Re: Warning : Running Arduino on USB Laptop battery on: January 08, 2011, 03:40:11 pm
Ya know, when I was a kid, I used to get Strep Throat all the time. It got to the point where I thought, and told everyone, that I was allergic to TaterTots, because I'd usually figure out I had Strep Throat again, while eating those things, and they were just rough/crunchy enough that they'd feel like I was swallowing glass. So I just began to believe that those things caused strep throat, and I made sure not to eat them anymore.
Moral of the story is, you're wrong about the USB port having ANYTHING to do with the battery in a laptop.
162  Forum 2005-2010 (read only) / Interfacing / Re: Emergency Light bar driven by Arduino MEGA on: January 05, 2011, 11:54:57 am
It's much safer to run a single resistor on each LED. Much more time consuming to make, but safer. Are you going to design a circuit board for this thing in something like Fritzing, or were you planning to build it on a perfboard? The thing about LED's and resistors is they don't lose brightness until you give them WAY too much resistance. So it's usually safest to just give them too much resistor rather than too little, especially if you want a long life out of them.
Another thing is that in a harsh automobile environment, they're going to put a lot of stress on their solder joints, simply because of the vibration and momentum, you might consider pouring some clear potting compound over them, after you've got it all confirmed working.
Personally, I'd use RGB LED's, especially with a Mega controlling them. Then you'd be able to do things like switch from blinking blue/red to blinking orange for caution, or blinking orange arrows, etc.
163  Forum 2005-2010 (read only) / Interfacing / Re: Wake up computer with a proximity sensor on: December 09, 2010, 01:57:55 pm
Servo to hit the space bar? smiley Or take the optical sensor out of a cheap/dead mouse, and wave the servo arm past it to simulate wiggling the mouse to wake the computer.
164  Forum 2005-2010 (read only) / Workshops / Re: Seattle Tacoma Users Group (Kitsap County too!) on: December 09, 2010, 01:48:47 pm
Hey guys.. This looks like fun. I joined your facebook group. Looks like you're meeting this Saturday. I won't be able to make it to that meet, but man would I love to. smiley Definitely next month.
165  Forum 2005-2010 (read only) / Exhibition / Re: Running high power objects on: January 20, 2011, 01:08:18 pm
That's an interesting design. Looks like you're using a pot to control the two transistors? It says Q2 is a TIP32A, what's Q1? Since it uses a pot, how would you control that with an Arduino?
I actually did use TIP122's and TIP127's because that's what I had laying around from past MegaSquirt projects.. smiley-wink Here are a couple pictures of what I built..

Pages: 1 ... 9 10 [11] 12 13