Show Posts
|
|
Pages: [1] 2
|
|
2
|
Using Arduino / Programming Questions / Controlling a Stepper Driver
|
on: August 15, 2012, 10:53:24 am
|
|
I've searched for hours and can't seem to find a simple way to control the speed and direction of a stepper motor using momentary switches and a potentiometer with Arduino.
I'm using a stepper motor paired to a Sparkfun Easy driver (and appropriate power supply), which requires only step/direction input.
I want to control the stepper to continuously turn as an electric window in a car. I want it to go up using a momentary switch and go down using a momentary switch, and use a potentiometer for speed control.
Does anybody have a sample code or list of functions that I can use to incorporate these features.
Send me your email address and I'll "sponsor" your time with $20 USD if you provide a working code.
Thanks! Steve
|
|
|
|
|
5
|
Using Arduino / Displays / Controlling pins using an LCD display
|
on: September 13, 2011, 10:46:32 am
|
I have spend several hours searching, but I cannot find this. Can someone please point me towards some sample code? Here's what I want to do. I am using a Nokia 3310 shield, see link below. http://www.nuelectronics.com/estore/index.php?main_page=product_info&products_id=12I want to be able to have multiple (about 40) menu items on the display, and when I select each menu item, I would like to be able to have other pins on the arduino go HIGH and LOW. Basically, I'm going to have about 10 LEDs plugged up to the arduino, and want to have different LED combinations turn on based on the menu item. I don't need any visual feedback on the display, I just need the LEDs to turn on. Any idea how to get the LCD to let me choose to turn an ouput pin HIGH? I am using the Arduino Mega 1280 Thanks! Steve
|
|
|
|
|
6
|
Using Arduino / Programming Questions / Analog to PWM question
|
on: February 11, 2011, 03:38:22 pm
|
Is it possible to have the PWM level increase in steps, based on a voltage range within 0-10V. My 0-10V source increases in steps of 0.1V. Arduino is reading somewhere between the lines, thus, causing almost negligible flickering of my lights which are controlled by the PWM output. I already have a low pass RC filter, which is a 30K resistor and 4.7uf cap...nevertheless it still has a slight flicker. For example - 0-0.1V = 1-2 (PWM - 1-2 out of the total 255) 0.1-0.2V = 3-4 ect. This is what I am using now: int val = 0; // variable to store the read value void setup() { // declare pin 9 to be an output: pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); pinMode(3, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); }
void loop() { int val = analogRead(0); val = map(val, 0, 1023, 0, 255); analogWrite(9, val);
val = analogRead(1); val = map(val, 0, 1023, 0, 255); analogWrite(10, val);
val = analogRead(2); val = map(val, 0, 1023, 0, 255); analogWrite(11, val);
val = analogRead(3); val = map(val, 0, 1023, 0, 255); analogWrite(3, val);
val = analogRead(4); val = map(val, 0, 1023, 0, 255); analogWrite(5, val);
val = analogRead(5); val = map(val, 0, 1023, 0, 255); analogWrite(6, val);
} Thanks!
|
|
|
|
|
10
|
Forum 2005-2010 (read only) / Interfacing / Re: Burning Bootloader problem
|
on: October 24, 2010, 05:26:54 pm
|
Ok, good tip. I went ahead and changed the ArduinoISP sketch to: #define SCK 52 #define MISO 50 #define MOSI 51 #define RESET 53
This was the only place in the code that I could see the actual pin number references, and I changed them accordingly. I got a verified upload! Thanks guys!
|
|
|
|
|
11
|
Forum 2005-2010 (read only) / Interfacing / Burning Bootloader problem
|
on: October 23, 2010, 08:55:15 pm
|
I am trying to burn a standard arduino bootloader on to a naked ATMega328 chip using Arduino Mega 1280 as ISP, using this guide http://arduino.cc/en/Tutorial/ArduinoToBreadboard . I have quadruple checked my wiring, despite how simple it is, and have redone it a dozen times. I have loaded the ArduinoISP successfully onto my Arduino Mega 1280, and get the heartbeat pulse. For some reason, it just won't burn. I am using a 16 crystal with caps. I have also tried using the Arduino Duemilanove as ISP too, with the same error message. Yes, I selected the correct board (duemilanove), and yes I am clicking on the 'Burn bootloader' option 'w/Arduino as ISP'. I get the same error messages repeatedly, and suspect it has something to do with the auto-reset. avrdude: stk500_program_enable(): protocol error, expect=0x14, resp=0x50 avrdude: initialization failed, rc=-1 Double check connections and try again, or use -F to override this check.
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51 I am open to any ideas and suggestions. Thanks!
|
|
|
|
|
12
|
Forum 2005-2010 (read only) / Interfacing / Re: Voltage to resistance (digital pot or PWM?)
|
on: October 17, 2010, 05:09:00 pm
|
Richard, Good idea, I thought I grabbed 10K, but I grabbed 10 ohms, 10Ks work great! I can't tell you how satisfied I am to see this work! Taking into account I'm not too familiar with Arduino code, - Regarding the multiple 'ins' and 'outs,' I tried this code, and I get an error at the 'int val'. Any ideas? int ledPin = 9; // LED connected to digital pin 9 int ledPin = 10; int ledPin = 11; int ledPin = 3; int ledPin = 5; int ledPin = 6; int val = 0; // variable to store the read value void setup() { // declare pin 9 to be an output: pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); pinMode(3, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); }
void loop() { int val = analogRead(0); val = map(val, 0, 1023, 0, 255); analogWrite(9, val);
int val = analogRead(1); val = map(val, 0, 1023, 0, 255); analogWrite(10, val);
int val = analogRead(2); val = map(val, 0, 1023, 0, 255); analogWrite(11, val);
int val = analogRead(3); val = map(val, 0, 1023, 0, 255); analogWrite(3, val);
int val = analogRead(4); val = map(val, 0, 1023, 0, 255); analogWrite(5, val);
int val = analogRead(5); val = map(val, 0, 1023, 0, 255); analogWrite(6, val);
}
|
|
|
|
|
13
|
Forum 2005-2010 (read only) / Interfacing / Re: Voltage to resistance (digital pot or PWM?)
|
on: October 17, 2010, 04:28:13 pm
|
|
The 0-10V source is a regulated lab power supply. I plugged it up again without the capacitors, turns out it was just a loose wire. I was using 26 ga wire into the larger female arduino connector and it was jiggling a bit.
Another issue I just ran in to is that the resistors in the voltage divider get hot and start smoking....and they weren't even plugged into arduino yet. Is there an IC that is a easy fix for a voltage divider, I just need V/2.
Thanks! Steve
|
|
|
|
|