Show Posts
Pages: [1] 2
1  Using Arduino / Motors, Mechanics, and Power / Re: CustomStepper - A library for stepper motors on: June 02, 2014, 09:36:06 pm
I was having similar problems to others in this thread trying to use this library with buttons etc. The issue seems to be that you need to call at least one stepper function before you call run() or else code execution haults. I haven't looked at the library but more than likely there's some initalized value that's no good.

So in your setup() method, just add something small like:

and everything should be fine.

I did some tests with the Custom Stepper Library and it worked.
At startup my motor turns 90 degrees to left and then 90 degrees to the right, which is correct according to the code.

What I want, is when I push button1 the motor turns 90 degrees to the left and when I press button2 , 90 degrees to the right.

This is the working code (example)
#include <CustomStepper.h>
CustomStepper stepper(8, 9, 10, 11);
boolean rotatedeg = false;

void setup()

void loop()
  if (stepper.isDone() && rotatedeg == false)
    rotatedeg = true;

Here's my changed code which is not working (with the implementation of the 1 button)

#include <CustomStepper.h>
CustomStepper stepper(8, 9, 10, 11);
boolean rotate1 = false;
boolean rotatedeg = false;
boolean crotate = false;

const int buttonPin = 4;    
int buttonState = 0;      

void setup()
  pinMode(buttonPin, INPUT);
void loop()
  buttonState = digitalRead(buttonPin);
  if (buttonState == HIGH)
    rotatedeg = true;;

Is there somebody facing the same problem, or can somebody help me with this?
Thank you

2  Forum 2005-2010 (read only) / Troubleshooting / SOLVED: blue screen of death on: June 23, 2008, 07:56:50 pm
Hey guys,

I just got my Diecimila board today and I was all excited to finally get started with Arduino after a very long time of thinking about it.

I plugged it in, installed the drivers that came with the online distribution and BOOM! Blue screen of death (BSOD).

I've tried every combination I can think of.

Power from a wall-wart. plug it in after the software starts up. Nothing works because as soon as I click "tools" in the software environment, I get a system crash.

Anyone know what I should do? I tried searching and couldn't find anything, am I the only one?!? smiley-sad

It seems to be driver related. Windows XP SP2


So i browsed the forum for a little bit and found this driver from worapoht.

and it seems to have worked. My LED is blinking smiley-grin
3  Forum 2005-2010 (read only) / Syntax & Programs / watchdog timer or another way to reset on: December 16, 2008, 02:38:19 am
Hello everyone, I found a problem with the Arduino. When I use a matrix keypad (3x4) and press the buttons stupid fast for a while variables don't get set (such as time) and my program goes nuts. I've found a way to detect if this were to happen (although rare) but I need a way to reset the Arduino.

I've read about the watchdog timer and it seems to be perfect but I can't figure out how to implement it. I don't have a problem burning a new bootloader either.

Anyone know how to do it? Or a similar technique? I don't really want to have a pin pull the reset button either (as this is wrong).

Thanks  smiley


lol omg, I'm retarded. I figured out the problem, I was using INTs instead of UNSIGNED LONGs to hold time variables  :smiley

hahha, of course it was crashing. Agh, gota stop programming at 3 am. It would still be nice to know about the watchdog tho  8-)
4  Forum 2005-2010 (read only) / Troubleshooting / Re: Sparkfun LCD Displaying Gibberish on: August 04, 2009, 12:36:52 am
You'll want to use the LiquidCrystal library. A nice tutorial has been setup here:

I should note that the library has been updated but it is not included int the 0016 package, you'll have to manually update the library yourself (drag and drop files, it's easy).

I would not recommend using the old LiquidCrystal library as it has timing issues that were never addressed until recently. I've used both and the new library is a little slower but about 100 times more reliable. The old library has been known (and i've personal had it happen)  to throw garbled text on the screen or not putting text on at all.

It's a good tutorial with good examples, give it a look over.
5  Forum 2005-2010 (read only) / Troubleshooting / can't burn bootloader - programmer worked B4 on: August 04, 2009, 12:58:17 am
I'm trying to put bootloaders on some new ATMEGA168-20PU chips I got. I've burnt bootloaders before on other new mega168's with the current equipment I'm using but i'm not getting any luck.

Here's my setup:
Arduino Diecimila
home-made parallel programmer (from bootloader DIY)
12v regulated power input

Windows XP SP3
My parallel port is configured for ECP.
I'm running 'GIVEIO' and i've even re-installed it.
My registry is modified (DisableWarmPoll)
parallel port configured for no interrupts and it sticks
Arduino version 0016
Environment configured for Diecimila w/ 168

my error is something like this:
avrdude: AVR device not responding
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0xffffff
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATMEGA168 is 1E 94 06
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0x00 != 0x07
avrdude: verification error; content mismatch

avrdude done.  Thank you.

Also, pin 13's LED turns on once the parallel programmer is inserted. I don't know if this means anything but I thought it was interesting.

I'm stumped. I've also tried it on another machine that's running Vista and still no luck. I've checked the programmer and resistors out, everything checks out.

thanks in advance.
6  Forum 2005-2010 (read only) / Interfacing / Re: LCD Special Characters on: February 26, 2009, 09:51:00 am
Thanks. That makes sense.
7  Forum 2005-2010 (read only) / Interfacing / LCD Special Characters on: February 26, 2009, 12:48:18 am
The HD44780 chip has two character tables in it's datasheet. pg 17 & 18.

One is labeled as ROM Code: A00 and the other as ROM Code: A02. Is there a way to access A02? It has much more symbols and frankly, I have no need for Chinese or Japanese (sorry, can't tell the difference with LCD font).

With the LiquidCrystal library, it gets all characters from A00. I read the datasheet and can't find any information on how to "unlock" the A02 ROM.

Any insight? I'm very new with LCDs.

8  Forum 2005-2010 (read only) / Interfacing / Re: Serial Relay Board on: February 18, 2009, 11:55:08 pm
Wow, thanks. I guess shift registers are the way to do it.
9  Forum 2005-2010 (read only) / Interfacing / Re: Serial Relay Board on: February 18, 2009, 06:20:58 pm
I guess my project would be similar to home automation, but that's not what it's for. The Arduino gets user input on what devices to turn on and these devices are turn on by their respective relays. I don't want devices switching on when they're not supposed to be on. So I don't know if a shift register would work properly.

I know i'll need to use transistors, the relays are going to be 5v coils and they'll be switching 12v lines.

The RC-4 is exactly what i'm looking for but I can make my own with an extra Arduino chip for less than that.

I think i'll poke around some home automation projects and see how they did it.
10  Forum 2005-2010 (read only) / Interfacing / Re: Serial Relay Board on: February 18, 2009, 02:44:22 pm
Can you write directly to a shift register?

Such as




instead of just shifting?
11  Forum 2005-2010 (read only) / Interfacing / Serial Relay Board on: February 18, 2009, 02:09:37 pm
I'm building a circuit and i don't have enough pins for the amount of relays I need to use. Right now, i really only need 4 relays but it may expand to many many more (prob no more than 8 or 16).

I can spare 2 pins for serial. I know exactly how I could design another arduino to do this job but i was wondering if there was already a pre-made circuit to do this.

bwahh, this may be too far confusing for a pre-made chip to do this. Maybe I'll just make it myself, but just wondering if anything exists.

Thanks again.  
12  Forum 2005-2010 (read only) / Interfacing / Re: Ethernet Probe? maybe packet sniffer? on: January 23, 2009, 12:01:52 pm
Awesome, thanks for the point in the right direction.
13  Forum 2005-2010 (read only) / Interfacing / Ethernet Probe? maybe packet sniffer? on: January 23, 2009, 01:45:01 am
I'm not exactly sure if I'm even thinking of this right. Here's my dilemma:

My father got some new machines from Italy with no documentation. We're currently trying to get some info from the manufacturer as to exactly how to interface the machines but the language barrier is a little hard. I'm not looking for a translator.

The machines have ethernet connections  and are supposed to talk to each other. Basically they receive  a when to start command, and send a completion command. More info may be sent but I'm not really interested in it.

The quicker I can get these machines up and running the better. They work on some type of private network but I really have no information at all about the specifics.

I can manually start the machines and have them run their cycles so I'm looking for a way to probe the ethernet connections to see what kind of data they're sending.

Is this possible? Hooking them together works because they're sending data, but I have no idea what, and it would be nice to setup some personalized software to control these new guys.

I also forgot to add, I have a controller that I can type in the machine number and tell it to start, and it will. The data is sent over ethernet. I fear that this is some type of custom setup made by the previous owners so there may be zero documentation. So i'm just looking to replicate what this controller sends and receives, it doesn't even have to make sense, although it would be nice.

Thanks for the help and a bump in any direction is better than where I am now.
14  Forum 2005-2010 (read only) / Interfacing / Re: Basic keypad is giving me the hardest time on: December 16, 2008, 03:41:34 am
I decided to write my own code and not use the keypad library. It works now, seemed to be a problem with the code or maybe the way I was interpreting it.
15  Forum 2005-2010 (read only) / Interfacing / Basic keypad is giving me the hardest time on: December 15, 2008, 05:07:03 pm
I'm at a point where I feel my mega128 may actually be blown. I know I've done some things to it and said "whoops" afterwords (all part of learning I guess) but it's been ok up until now.

Here's the question. Do I need to add resistors to my keypad input pins to protect the Arduino from performing a 'short to ground'? or is a short to ground ok as long as its going from one pin to another, (IE it won't short out because the chip is "smart"? lol IDK)

I'm using the keypad library and let's say I have col0 as pin 2, and row0 as 3, if I shove a jumper wire from 2 - 3 I don't get a response from the board. What's up?

Agh, going crazy, thanks so much.
Pages: [1] 2