Show Posts
Pages: 1 ... 7 8 [9] 10 11 ... 72
121  Using Arduino / Programming Questions / Re: Controlling servo position with 2 switches, but servo shakes out of position on: March 13, 2014, 09:55:46 pm
Where, in your code, are you keeping track of the current servo position?
122  Using Arduino / Programming Questions / Re: Stepper Motor Programming on: March 13, 2014, 09:39:54 pm
Here is the code I have so far.
You need a flag to keep track of when the door is open and when it is closed.
Code:
...
boolean doorOpen = 0;
 //Assumes the door is closed at start. If not, doorOpen = 1;
void setup() {
 Serial.begin(9600);
 // set the PWM and brake pins so that the direction pins 
// can be used to control the motor:
pinMode(pwmA, OUTPUT);
 pinMode(pwmB, OUTPUT);
 pinMode(brakeA, OUTPUT);
 pinMode(brakeB, OUTPUT);
 pinMode(motion_1, INPUT);
 digitalWrite(pwmA, HIGH);
 digitalWrite(pwmB, HIGH);
 digitalWrite(brakeA, LOW);
 digitalWrite(brakeB, LOW);

 
 // initialize the serial port:
 Serial.begin(9600);
 // set the motor speed (for multiple steps only):
 myStepper.setSpeed(80);
}
void loop()
{
if( digitalRead(motion_1)== HIGH && doorOpen == 0){
//PIR detecting and door not open
  myStepper.step(200);  //adjust to do number of steps to open door
  doorOpen =1;  //remember that the door is open
   }
if( digitalRead(motion_1)==LOW&& doorOpen == 1){
//PIR NOT detecting and door open 
  myStepper.step(-200);   //adjust to do number of steps to close door
   doorOpen =0;  //remember that the door is closed
   }
}
Please post your code between code tags, the # key above the input box.
123  Using Arduino / Programming Questions / Re: While loop not behaving as expected! on: March 13, 2014, 08:57:21 pm
pretty sure the line
while ((Switch0 == LOW)  || (Switch3 == LOW)); {
should be
while ((Switch0 == LOW)  || (Switch3 == LOW)) {

Basically removed the apostrophe, pretty sure that'll fix your problem
It's the semicolon that he needs to remove. There's no apostrophe there.
124  Using Arduino / General Electronics / Re: Can someone please tell me the identity of this 7 segment display on: March 12, 2014, 10:27:06 pm
Do you have a multimeter?
You can use the diode test function to bias the pins and find out by process of elimination.
It's not unusual that an ohmmeter can provide enough current to, likewise, dimly illuminate the LEDs.
I've a digital multimeter, but it has no diode test function. I never thought of using it. Thanks for the suggestion.
125  Using Arduino / Project Guidance / Re: I am a COMPLETE noob at programming on: March 12, 2014, 09:47:18 pm
Was there not a booklet or a link to a website with your kit? If there was, I would start with there.
Work your way through all the examples, whether you think they're relevant or not.
There are some good (and some bad!) tutorials on YouTube. You should Google TinyDuino tutorial to find those.
126  Using Arduino / Project Guidance / Re: New to Arduino; Trying to Figure Feasibility on: March 12, 2014, 09:27:47 pm
How much data? Kb, Mb, Gb, Tb, Pb?
Where do you intend to store it? The Arduino  itself has limited memory but can access SD cards and other memory storage devices.
127  Using Arduino / General Electronics / Can someone please tell me the identity of this 7 segment display [Sorted] on: March 12, 2014, 09:19:16 pm
I've a seven segment display made by Fairchild. I've had it for donkeys years, still in it's original package. It carries the number ND10402-531. It is very small,  approx. 5mm * 6mm with 9 legs, not pins, as they're about 10mm long.
One row of 4 legs at the top, another of 4 legs at the bottom and the ninth leg in the centre.
Googling it brings up nothing relevant.

I presume the centre pin is the common one, but is it common anode or common cathode?
128  Using Arduino / Programming Questions / Re: Help with code In return a box of Components as a thank you on: March 12, 2014, 12:21:04 am
I have to agree with PaulS about the coding style. I know I sure won't spend an hour formatting it into a readable state.
You must be a very slow typist if it takes you an hour to hit Ctrl + T.
129  Using Arduino / Programming Questions / Re: Long boot delay when connecting to Arduino Mega with USB serial port on: March 12, 2014, 12:10:22 am
It's more likely your computer, not the Mega, that's causing the problem. It sounds as if you're getting the monitor window opening but the initialization of the comms is being delayed. Your second edit would appear to confirm this. Have you tried with a different USB port or a different computer?
130  Using Arduino / Project Guidance / Re: Organizing a course on: March 11, 2014, 11:23:30 pm
How about a thermometer.
Stage 1:
Have a row of LEDs 3 blue, 3 green and 3 red.
Determine which LED is lit by the temperature of the thermistor.
Stage 2:
Have a sound alarm go off if the temperature rises too far (1st red LED lit) and a different tone if the temperature falls too far (3rd blue LED lit)
Stage 3: Adjust the temperature of the middle green LED to 21oC and the adjacent LEDs in steps of 1oC.
They've now built a visual and audio alarm system for an elderly person (grandparent?) so that they don't overheat or suffer from hypothermia.
131  Using Arduino / Project Guidance / Re: arduino makes wrong outputs on: March 11, 2014, 10:56:21 pm
It is line 32 of your code. I am great at mind reading.
My crystal ball tells me it's line 27 and my tea leaves line 12.  smiley-lol
132  Using Arduino / Programming Questions / Re: need help with 7-segment counter on: March 10, 2014, 09:34:42 pm
Tens = number to be output/10 (Ints ignore fractions)
Units = number to be output modulo 10 (see % in Reference)
133  Community / Bar Sport / Re: Denglish on: March 08, 2014, 11:46:01 pm
(levee is a new word to me, learned it from the wiki page jantje referred to)
Note that levee is an American English word probably originating from the French 'eleve' (sorry, no accents) meaning 'raised'. In England, we would use the word "dyke" to describe a barrier that holds back water.
134  Using Arduino / Project Guidance / Re: Relay control with Buttons on: March 08, 2014, 09:44:07 pm
Unfortunately had to go do something called WORK
I vaguely remember doing something called that, before I retired  smiley-grin
Quote
I'm now having trouble with latching buttons, as each sequence will run continuously if I hold down the button, which can work if I can just implement the latch to work properly. examples on the net refer to only one button.... tried several different ways but can't get them to work properly.
the code below is what I came up with without the latching buttons. PLEASE HELP!
You only need to set each pin as an output once. ledPins3[] holds all four LED pins (0 to 3) so just use:
Code:
   for (int thisPin = 0; thisPin < pinCount3; thisPin++)  {
    pinMode(ledPins3[thisPin], OUTPUT);
}
to set them. There's no need for the other three for loops.
To overcome your buttons not latching, look up 'Finite State Machine' or else use latching switches. DIP switches might be what you need.
135  Using Arduino / General Electronics / Re: Motorized paper feeder? on: March 08, 2014, 12:05:18 am
The note feeder one. I will use it to feed out pre-printed tickets with the arduino.
What size are the tickets? If they are big enough, maybe you could adapt a (6" * 4" photo) printer.
Pages: 1 ... 7 8 [9] 10 11 ... 72