Show Posts
Pages: 1 [2] 3 4 5
16  Using Arduino / Programming Questions / Re: sketch error ?? help on: September 18, 2012, 05:14:15 pm
no ????
17  Using Arduino / Programming Questions / sketch error ?? help on: September 18, 2012, 05:04:56 pm
i got this sketch off the net it shows the stepper working but when i upload the sketch i get errors
why

// accellsteppertest.ino
// Runs one stepper forwards and backwards, accelerating and decelerating
// at the limits. Derived from example code by Mike McCauley
// Set for 28BYJ-48 stepper

#include <AccelStepper.h>

#define FULLSTEP 4
#define HALFSTEP 8

//declare variables for the motor pins
int motorPin1 = 8;   // Blue   - 28BYJ48 pin 1
int motorPin2 = 9;   // Pink   - 28BYJ48 pin 2
int motorPin3 = 10;   // Yellow - 28BYJ48 pin 3
int motorPin4 = 11;   // Orange - 28BYJ48 pin 4
                        // Red    - 28BYJ48 pin 5 (VCC)

// The sequence 1-3-2-4 required for proper sequencing of 28BYJ48
AccelStepper stepper2(HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4);

void setup()
{    
  stepper2.setMaxSpeed(1000.0);
  stepper2.setAcceleration(50.0);
  stepper2.setSpeed(200);
  stepper2.moveTo(2048);
}

void loop()
{
  //Change direction at the limits
  if (stepper2.distanceToGo() == 0) {
    stepper2.moveTo(-stepper2.currentPosition());
  }
  stepper2.run();
}




errors are
sketch_sep18c:18: error: 'AccelStepper' does not name a type
sketch_sep18c.cpp: In function 'void setup()':
sketch_sep18c:22: error: 'stepper2' was not declared in this scope
sketch_sep18c.cpp: In function 'void loop()':
sketch_sep18c:31: error: 'stepper2' was not declared in this scope
sketch_sep18c:34: error: 'stepper2' was

thanks marko
18  Using Arduino / Project Guidance / Re: twinkle led's on: September 16, 2012, 03:42:16 pm
would this sketch be ok once i mod it ?
http://joesgizmos.wordpress.com/2012/07/06/twinkle-leds/


i'm getting in to multiplexing soon
19  Using Arduino / Project Guidance / twinkle led's on: September 16, 2012, 03:03:13 pm
hi all
i know the mega wich i have has got Digital I/O Pins   54 (of which 15 provide PWM output)
can i get all the 54 pins to twinkle an individual led like stars in the sky at night in a random pattern ??
or what would be the better alternative?
20  Using Arduino / Project Guidance / IRL520 schematic help for all led circuits on: July 17, 2012, 04:04:08 pm
hi all
is it safe for me to say that i should use this circuit for all power mosfets IRL520 and small transistors such as the 2N2222A
I know R1 is current limiting
but what about R2/R3
is this just for safe measure ??
cheers
marko
21  Using Arduino / Project Guidance / Re: what Semiconductor to use for 5 Amp max on: July 05, 2012, 06:14:24 pm
thanks i thought you would say this lol i got some and ordering more now thanks was using irf520's but 2  expensive for what i need
22  Using Arduino / Project Guidance / Re: Soldering wire issue (not "stick") on: July 05, 2012, 05:32:12 pm
try using a crimp ferrule on the and solder to that
23  Using Arduino / Programming Questions / Re: simultaneously turn on 2 led's on: July 05, 2012, 04:59:00 pm
this sketch works on my mega
can anyone see any errors with it ?

/*
  Blink
  Turns on an LED
  This example code is in the public domain.
 */

void setup() {               
  // initialize the digital pin as an output.
  // Pin 2/ has an LED connected on most Arduino boards:
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
}

void loop() {
  digitalWrite(2, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(2, LOW);    // set the LED off
  delay(0);              // wait for a second
 
   digitalWrite(3, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(3, LOW);    // set the LED off
  delay(0);              // wait for a second
 
   digitalWrite(4, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(4, LOW);    // set the LED off
  delay(0);              // wait for a second
 
   digitalWrite(5, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(5, LOW);    // set the LED off
  delay(0);              // wait for a second
 
   digitalWrite(6, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(6, LOW);    // set the LED off
  delay(100);    // wait for a second
 
   digitalWrite(7, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(7, LOW);    // set the LED off
  delay(100);
 
  digitalWrite(3, HIGH);     
  digitalWrite(6, HIGH);
  delay(50);
  digitalWrite(3, LOW);     
  digitalWrite(6, LOW);
delay(500);
  digitalWrite(4, HIGH);     
  digitalWrite(5, HIGH);
  delay(50);
  digitalWrite(4, LOW);     
  digitalWrite(5, LOW); 
 
     digitalWrite(4, HIGH);   
  delay(100);             
  digitalWrite(4, LOW);   
  delay(100);             
}
24  Using Arduino / Project Guidance / what Semiconductor to use for 5 Amp max on: July 05, 2012, 04:07:51 pm
hi all
what would be the best Semiconductor to use for 5 Amp max
it is only to fade in and out a 5 watt led
5 watts = 0.41 amp
the cheaper the better
thanks
marko
25  Using Arduino / Programming Questions / Re: simultaneously turn on 2 led's on: July 04, 2012, 06:25:30 pm
thats acceptable 125ns but where would i put the code in the sketch ?
26  Using Arduino / Programming Questions / Re: simultaneously turn on 2 led's on: July 04, 2012, 06:20:48 pm
i'm using a mega
so what you are saying is use another pin to connect to both led's ?
am i right
and what is the best transistor to use for 2 amps
27  Using Arduino / Programming Questions / Re: simultaneously turn on 2 led's on: July 04, 2012, 06:02:54 pm
i tried this but one led lights up befor the other but i want them simultaneously

 digitalWrite(3, HIGH);     
  digitalWrite(7, HIGH);
  delay(50);
  digitalWrite(3, LOW);     
  digitalWrite(7, LOW);
28  Using Arduino / Programming Questions / Re: simultaneously turn on 2 led's on: July 04, 2012, 05:44:36 pm
how do i digital write 2 pins ?
29  Using Arduino / Programming Questions / simultaneously turn on 2 led's on: July 04, 2012, 05:26:39 pm
hi all
i'm using this sketch to flash led's at the end of the sketch i would like to flash leds on pins 4 and 7 simultaneously can any one tell me if its possible and how to do it
thanks
marko


/*
  Blink
  Turns on an LED
  This example code is in the public domain.
 */

void setup() {               
  // initialize the digital pin as an output.
  // Pin 2/7 has an LED connected on most Arduino boards:
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
}

void loop() {
  digitalWrite(2, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(2, LOW);    // set the LED off
  delay(0);              // wait for a second
 
   digitalWrite(3, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(3, LOW);    // set the LED off
  delay(0);              // wait for a second
 
   digitalWrite(4, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(4, LOW);    // set the LED off
  delay(0);              // wait for a second
 
   digitalWrite(5, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(5, LOW);    // set the LED off
  delay(0);              // wait for a second
 
   digitalWrite(6, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(6, LOW);    // set the LED off
  delay(2000);              // wait for a second
   digitalWrite(7, HIGH);   // set the LED on
  delay(50);              // wait for a second
  digitalWrite(7, LOW);    // set the LED off
  delay(50);   
 
}
30  Using Arduino / Programming Questions / Re: looking for a sketch for Close encounters of the third kind on: June 24, 2012, 05:55:58 am
yes its just for the light sequence near the end
Pages: 1 [2] 3 4 5