Show Posts
Pages: 1 ... 8 9 [10] 11 12 ... 20
136  Using Arduino / Project Guidance / Re: stepper motor control on: September 11, 2012, 03:01:00 pm
thanks for that but when button if high the stepper funs continuosly in the one direction
137  Using Arduino / Project Guidance / stepper motor control on: September 10, 2012, 03:19:22 pm
hi there i have made this code up,i would like to add another function, when a switch pin goes high the stepper will return to its 0 position and when the pin goes low the stepper will return the where the pot is set to. how do we do this?

Code:

#include <Stepper.h>

// change this to the number of steps on your motor
#define STEPS 100

Stepper stepper(STEPS, 8, 9, 10, 11);

// the previous reading from the analog input
int previous = 0;

void setup()
{
  // set the speed of the motor to 30 RPMs
  stepper.setSpeed(150);
}

void loop()
{
  // get the sensor value
  int potVal = analogRead(0);
  int stpPos = map(potVal, 0, 1023, 0, 100);

  stepper.step(stpPos - previous);

  // remember the previous value of the sensor
  previous = stpPos;
}
138  Using Arduino / Project Guidance / Re: variating an ouput over time on: September 09, 2012, 01:36:43 pm
thanks johnwasser for that can you explain what is going on in it?
139  Using Arduino / Project Guidance / Re: variating an ouput over time on: September 08, 2012, 04:51:48 pm
forget it, as by the time ive started writing it down i have already forgotten what i was going to write lol
140  Using Arduino / Project Guidance / Re: variating an ouput over time on: September 08, 2012, 12:22:20 pm
Quote
Do you know how to read the state of a switch?

yes

Quote
Do you know how to do it repeatedly? Do you know how to record the previous state and detect when the current state is different to the previous state?

no
141  Using Arduino / Project Guidance / Re: variating an ouput over time on: September 08, 2012, 03:18:47 am
yes ok
so how do we do that then?
142  Using Arduino / Project Guidance / Re: variating an ouput over time on: September 07, 2012, 04:59:17 pm
Quote
just a linear change in the duty cycle starting at zero and ending at the maximum defined by your pot?

yes and to go the other way when the switch is in the opposite direction

Quote
Is it possible that either of the pots will be adjusted during this timed processing?

no

Quote
You mentioned a switch - do you need to deal with the switch going low or high after it has triggered this process? Do you want to respond to any further changes to the switch state during the time processing? How about after it has completed?

i was using the switch to trigger the process for example when the switch goes high it will slowly increase the pin over the duration the one pot is set to and to the maximum point the other pot is set to when that point has reached it will stay there until the switch goes low and then it will wind back down to 0 over the period of time the pot is set at
143  Using Arduino / Project Guidance / Re: variating an ouput over time on: September 07, 2012, 11:55:18 am
Quote
What do you want to happen when the end of the 5-to-25-minute time interval is over?


nothing just want it to variate an output over a period of time when a switch go's high
144  Using Arduino / Project Guidance / variating an ouput over time on: September 06, 2012, 03:50:18 pm
hi there
im trying to alter a pwm output over a period of time which can be adjusted by a potentiometer from 5mins to 25mins and also another potentiometer to adjust the maximum position it will go up to any ideas of how to do this or any examples anyones got ?
145  Using Arduino / Displays / Re: ITDB02_Touch problems on: August 27, 2012, 12:23:57 pm
ok what have i dun now lol

Code:

// UTFT_Demo_320x240

#include <UTFT.h>
#include <ITDB02_Touch.h>
// Declare which fonts we will be using
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];

// Uncomment the next line for Arduino Mega
UTFT myGLCD(ITDB32S,38,39,40,41);   // Remember to change the model parameter to suit your display module!
ITDB02_Touch  myTouch(6,5,4,3,2);

int x, y;
char stCurrent[20]="";
int stCurrentLen=0;
char stLast[20]="";

void setup()
{

  // Setup the LCD
  myGLCD.InitLCD();
  myGLCD.clrScr();
  myGLCD.setFont(BigFont);

  myTouch.InitTouch(LANDSCAPE);
  myTouch.setPrecision(PREC_MEDIUM);

  pinMode(13, OUTPUT);
  //                               L,R   up, down
  myGLCD.print("LIGHTING CONTROL", 25, 300);
  myGLCD.print("ON", 54, 385);
  myGLCD.print("OFF", 218, 385);
  myGLCD.setColor(0, 0, 255);



  //                 T,L  B,L  T,R  B,R 
  myGLCD.drawRoundRect(50,100,100,170);        // Draw a rectangle
  myGLCD.drawRoundRect(220,100,270,170);        // Draw a rectangle
  myGLCD.setColor(0, 300, 255);

}

void loop()
{


  if (myTouch.dataAvailable())
  {
    myTouch.read();
    x=myTouch.getX();
    y=myTouch.getY();

    if ((y>=50) && (y<=100)) 
    {
      if ((x>=100) && (x<=170))  // Button: On
      {
        digitalWrite(13, HIGH);   // set the LED on
      }
      if ((x>=270) && (x<=170))  // Button; Off
      {
        digitalWrite(13, LOW);    // set the LED off
      }
    }
  }
}

146  Using Arduino / Project Guidance / Re: arduino glitching on: August 27, 2012, 11:29:29 am
thanks for that
the one thing what stood out for me was surpressing my load anyone know any links that have good information on this
147  Using Arduino / Project Guidance / arduino glitching on: August 27, 2012, 07:49:57 am
hi there
ive made a heating control board that glitches now and then, and resets the arduino any ideas of what could be causing this to happen?
my setup is:
12V from transformer (off load 20volts)
KBP005M rectifier
66 uf capacitor
L7805  volatage regulator
100uf capacitor
0.1uf ceramic capacitor

this might be coincedence but i dont know but when there is just a mains feed on the board with nothing else connected it apears to work fine i did also try when everything was connected a surpresser on the incoming of the board but obviously there are some noisy componenets around such as a fan, ignition transformer, and 2x solenoid valves
any ideas?
148  Using Arduino / Project Guidance / Re: variable on: August 24, 2012, 03:01:05 pm
will i have tried it lol
i tried changing the high and low around still not bring the LED on straight forward?
149  Using Arduino / Project Guidance / Re: variable on: August 24, 2012, 02:08:53 pm
am i on the right line?
i did noticed the LED starts LOW not HIGH?

Code:


const int ledPin =  13;      // the number of the LED pin
long sensorPin = A0;    // select the input pin for the potentiometer
long sensorValue = 0;  // variable to store the value coming from the sensor
// Variables will change:
int ledState = LOW;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated


void setup() {
  // set the digital pin as output:
  pinMode(ledPin, OUTPUT);     
}

void loop()
{

  long sensorValue = analogRead(sensorPin);
  long sensor = map(sensorValue, 0, 1023, 30000UL, 1500000UL);
  unsigned long currentMillis = millis();

  if(currentMillis - previousMillis > sensor) {

    previousMillis = currentMillis;   

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(ledPin, ledState);
  }
}
150  Using Arduino / Project Guidance / Re: variable on: August 24, 2012, 12:49:41 pm
ok whick on?
Pages: 1 ... 8 9 [10] 11 12 ... 20