Show Posts
Pages: 1 ... 45 46 [47] 48 49 ... 109
691  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)
692  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.
693  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.
694  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.
695  Using Arduino / Programming Questions / Re: Timing Function in Loop not working after correcting Braces. on: March 07, 2014, 11:49:33 pm
Code:
void loop()
{
    thisMillis = millis();
    if(thisMillis - lastMillis > delayMillis){
        lastMillis = thisMillis;
    }
 What is that supposed to achieve ? If it's a delay, then move the last curly brace to the end of the bit you want to delay.
Code:
    connectLoop++;

    // if more than 10000 milliseconds since the last packet
    if(connectLoop > 10000)
 How do you know that the preceding code takes more than 1 millisecond?
Quote
This at least might look like a usable construct
Not to me.
696  Using Arduino / General Electronics / Re: Alternative to reed switches in camera control project on: March 07, 2014, 12:22:31 am
Quote
Not only that, but those wires are only connected at one end so no current can flow in them.

That depends on the capacitance of the wires.
pf...   smiley-grin
697  Using Arduino / General Electronics / Re: Motorized paper feeder? on: March 07, 2014, 12:17:28 am
In a receipt printer the paper comes off a roll. In a note feeder, they are separate cut sheets. Which do you want?
698  Using Arduino / General Electronics / Re: First Project Help on: March 07, 2014, 12:12:33 am
as for the resistors, just make them 5k and 2k instead of 500 and 200? Do I keep the wattage at 3, or drop it still?
As you've now got 10 times the resistance there will be 1/10th the current flowing through them.
Quote
I didn't know what to do about your homework because it doesn't seem that you understood my circuits. I don't have 20v on each circuit. Each array has 20v, and I am splitting each array into 3 circuits of equal voltage wich rounds to 7v. making 6 7v circuits instead of 2 20v ones
How did you exactly divide 40 cells by 3? Did you cut one cell into thirds?
699  Using Arduino / Project Guidance / Re: Relay control with Buttons on: March 06, 2014, 11:17:07 pm
During delay(), your Arduino just sits there doing nothing. Look at the Blink Without Delay example in the IDE to see how to overcome this.
700  Using Arduino / General Electronics / Re: Alternative to reed switches in camera control project on: March 06, 2014, 12:31:34 am
Quote
I do understand that they are NOT working in that diagram -

I may be totally wrong here (shoot me down if I am - please), but isn't the original designer intending for the wire laid alongside the reed switch to supply the magnetic field to switch the reed switch when the relevant Arduino pin is made high?

Bernie
Getting enough amps from the national grid for that to happen will be a problem.  Reed switches need quite a few ampere-turns (10 to 50) to operate so expecting to get that amount of magnetic field from only a part turn (straight wire) will take an amazing amount of current
Not only that, but those wires are only connected at one end so no current can flow in them.
701  Using Arduino / Programming Questions / Re: Not sure how to implement mills() in 7-segment program on: March 06, 2014, 12:14:43 am
I am trying to implement mills() into my program in place of delay so that I can add in part of my program which is a traffic light. This is the counter which will be counting down to the light changing. I understand what the millis() function is, however i've been having difficulties trying to figure out how to properly use it in a program. Any help would be appreciated bellow is my code. Also i'm trying to figure out how to get both displays working together where the one will act as the ten's changing every 10 seconds and the other will function as the ones counting every second. This is my first project and it has been a difficult learning experience but a learning experience none the less smiley
Code:
void pause(long interval) {                               
// attempt at defining variable millis instead of having to use delay
  previousMillis = millis();          // previousMillis is millis
  if(millis() - previousMillis < 1000){  
  // if millis - previousMillis is less than 1000
  }
}
That will return immediately as you've just set previousMillis=millis() and millis() - previousMillis will always be less than 1000. while(millis() - previousMillis <1000); will work, but is 'blocking code' like delay() is.
Code:
void loop() {
  unsigned long currentMillis = millis();
  ////why are you defining currentMillis within loop()?
  ////It should be defined at the start of your program.
  ////then just use currentMillis = millis(); here
  if(currentMillis - previousMillis >= interval) { 
// if currentMillis - previousMillis is greater than or
// equal to interval of 1000
////As you've given previousMillis a value of 0, this will
//// always be true the first time around the loop.
////You should define previousMillis =millis() before setup()
      previousMillis = currentMillis;               
// previousMillis = currentMillis increasing currentMillis
// to keep up with millis
////   Define  count  = 9;  before setup()
     sevenSegWrite1(count);
      // Displays the current number in the sequence on the 7-segment display
     count--;
     if (count<0) count = 9; //for continuous countdown
       }   
   }
}
Watch your line length! Having to scroll across nearly 2 page widths to read your comments makes it very difficult to read your code.
702  Using Arduino / Programming Questions / Re: need help repeating the same code over and over on: March 05, 2014, 11:25:52 pm
I've not come across this TVout before. Can it be used for 50Hz PAL (not NTSC) TVs?
703  Using Arduino / Programming Questions / Re: Arduino School Project on: March 05, 2014, 10:59:11 pm
If they get it wrong, do you need to tell them the correct answer? They can simply press each button (A,B,C & D) in turn to see which answer is correct.
704  Using Arduino / Programming Questions / Re: Arduino School Project on: March 05, 2014, 10:19:14 pm
suggest this change..
Code:
int read()
{
  ///This function turns on the array of IR LEDs, then stores
  ///the values of the IR detectors to a byte. This byte matters
  ///because each individual card will have its own code, which will
  ///determine what the answer is.
  digitalWrite(IRLEDPin, HIGH); // when turned off ??
  byte IR1 = digitalRead(IR1Pin);
  byte IR2 = digitalRead(IR2Pin);
  byte IR3 = digitalRead(IR3Pin);
  byte IR4 = digitalRead(IR4Pin);
  byte IR5 = digitalRead(IR5Pin);
  return 16*IR1 + 8*IR2 + 4*IR3 + 2*IR4 + IR5; // 0..31
}//************
int FunctionAnswer(int code)
{
  ///This function takes the code read by the IR detectors and
  ///can tell what the answer is for every code.
  if (code>=1 && code<=7) return 1;
  if (code>=8 && code<=14) return 2;
  if (code>=15 && code<=22)return 3;
  if (code>=23 && code<=30)return 4;
  return 0;
}
//***************
int FunctionInput()
{
  ///This function measures to see which button is pressed.
  ///The button is stored in "input"
  //  from here belongs on to with 'the others
  const byte ButtonAPin = 9; //Pushbutton answer A
  const byte ButtonBPin = 10; //Pushbutton answer B
  const byte ButtonCPin = 11; //Pushbutton answer C
  const byte ButtonDPin = 12; //Pushbutton answer D
  // move to "setup"
  pinMode(ButtonAPin, INPUT);
  pinMode(ButtonBPin, INPUT);
  pinMode(ButtonCPin, INPUT);
  pinMode(ButtonDPin, INPUT);
  // to here.... 
  if (digitalRead(ButtonDPin)) return 4;
  if (digitalRead(ButtonCPin)) return 3;
  if (digitalRead(ButtonBPin)) return 2;
  if (digitalRead(ButtonaPin)) return 1;
  return 0;
}
Or:
Code:
int read()
{
  ///This function turns on the array of IR LEDs, then stores
  ///the values of the IR detectors to a byte. This byte matters
  ///because each individual card will have its own code, which will
  ///determine what the answer is.
  digitalWrite(IRLEDPin, HIGH); // when turned off ??
   // the variables IR1 to IR5 are not used elsewhere and can be removed.
  code = 16*(digitalRead(IR1Pin)) + 8*(digitalRead(IR2Pin))
       + 4*(digitalRead(IR3Pin)) + 2*(digitalRead(IR4Pin))
          + (digitalRead(IR5Pin)); // 0..31
}
705  Using Arduino / Project Guidance / Re: TV Antenna rotation control w/ stepper motor on: March 05, 2014, 09:51:46 pm
Perhaps.

I don't know where the OP wants to watch TV. In the UK this website will give the compass bearing to the different transmitters. Works very well. http://www.ukfree.tv/txlist.php
Maybe he lives in Luxembourg and wants to receive signals from all the surrounding countries, as well as RTL.
Pages: 1 ... 45 46 [47] 48 49 ... 109