Show Posts
Pages: [1] 2 3 ... 73
1  Using Arduino / Programming Questions / Re: Adjusting simple (so it should be) shift register coding for a different result on: Today at 09:35:06 pm
Try:
Code:
#include <Servo.h>
 
int potPin = 0;
int servoPin = 9;
Servo servo;
int latchPin = 5;
int clockPin = 6;
int dataPin = 4;
int leds = 0;
 
void setup() {
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT); 
  pinMode(clockPin, OUTPUT);
  servo.attach(servoPin);
}
 
void loop(){
  int reading  = analogRead(potPin);   // 0 to 1023
  int angle = reading / 6;  //0 to 100-ish
  servo.write(angle);
  int numLEDSLit = reading / 228;  //You only want max. 4 LEDs lit.
  leds = 0;
  if (angle >= 55){  //positive half of turn
    for (int i = 4; i < (numLEDSLit+4); i++){
       bitSet(leds, i);    // lights LEDs 4 to 7
    }
  }
  else if (angle<=45){  //negative half of turn
    for (int i = (numLEDSLit -1) ; i >-1; i--){
       bitSet(leds, i);
    }     // lights LEDs 3 to 0
 }
// angles between 46 and 54 (centre of turn) will have no LEDs lit
updateShiftRegister();
}
 
void updateShiftRegister(){
   digitalWrite(latchPin, LOW);
   shiftOut(dataPin, clockPin, LSBFIRST, leds);
   digitalWrite(latchPin, HIGH);
}
Also look at the map function.
2  Using Arduino / Programming Questions / Re: How to read data from any of the usb ports using the arduino on: Today at 08:46:35 pm
Quote
Can someone please tell me how to do this?
I have a bank of phones. I only want to answer the phone if it is my friend Joe calling. How can I do that?

You can't. You have to know that the Arduino is connected to the port you are opening, or you have to open the port and ask if the Arduino is on the other end. Of course, in order to do that, the Arduino must be expecting the question, and provide the appropriate answer AND any other application already on the port can not be disturbed by your intrusion on the port.
I get the impression that he wants to use his Arduino like a memory stick. Plug it into any USB port on any computer and read the data from it. As you said, it can't be done.
3  Using Arduino / Programming Questions / Re: Uploading errors using windows xp on: April 19, 2014, 08:33:28 pm
Save your changes and restart XP.
4  Using Arduino / Project Guidance / Re: Token detection. on: April 19, 2014, 07:30:24 pm
You mean RadioShack doesn't carry 10 micron double sided tape ? (darn..)
@Henry,
Has anyone noticed we are on Reply#18 and the OP hasn't posted again since his initial ?
Reply #2 was from him, but not much help in describing what he wants.
5  Using Arduino / Project Guidance / Re: difference between these two shields on: April 19, 2014, 07:21:38 pm
SparkFun Xbee shield and Adafruit XBee adapter kit? Why is one called shield and the other called adapter?
A shield is made to fit on top of your Arduino, an adapter isn't, although it can be used with an Arduino.
Quote
Any disadvantages in using the adapter on an arduino?
Other than it's not a direct plug-in, no.
6  Using Arduino / Project Guidance / Re: Token detection. on: April 18, 2014, 08:38:17 pm
So we don't know if it's ok to stick RFID tags on the token with double-sided tape ? (that almost sounds like cheating...)
His tokens may be 10 microns * 10 microns. I don't think double sided tape is going to work on those!   smiley-wink

His surface could be a 3 feet thick block of polished granite, for all we know. Where would you stick the RFID readers?  smiley-cool

He hasn't given us any clues, maybe because he doesn't have one...
7  Using Arduino / Project Guidance / Re: Driving an automotive fuel gauge on: April 18, 2014, 07:28:35 pm
Hey everybody
I'm having some trouble hooking up a fuel gauge to my Arduino.  In a normal situation the sender is basically a variable resistor.  The gauge I have is programmable and uses a stepper motor to move the needle.  It has a range of 0 - 270 ohms.  Full and empty can be at either end and the gauge will compute the proper level and display it.

What I'm having issues with is making the Arduino output a linear resistance that the gauge can use.  I've done a bunch of research and can't quite find something that works properly.  Most things I've tried will work nice near one end of the scale, but will jump on the other end.
Is the pot you're using a linear one or a logarithmic one?
8  Using Arduino / Project Guidance / Re: Sending DIY code through IR on: April 17, 2014, 07:59:39 pm
I have searched for some projects regarding the measurement of voltage with an analog pin and noticed they all work pretty good. Although the lack of precision resistors the voltage is measured pretty accurately. But I also have seen most of the projects are battery powered and they use the method to know when the battery is almost empty. Therefore if the Arduino is powered by a battery, it’s address will change overtime when the battery starts to lose power.
Well spotted. I hadn't thought of that. I'd assumed that they had mains derived power.
Quote
How many trains do you want? Your original post said just a couple!
Quote
That’s the thing, I don’t know how much trains there will be. This project is to see if I can get automated trains to run on a track layout. If this works on a small scale, we are going to try and expand the layout. The idea for this project goes back a long time. Because my father loves LEGO trains, he was asking me to do something to make them drive by themselves. But last year I went on a school-fieldtrip to Germany. There we visited this: Miniatur Wunderland. Here there are like 100’s of trains running through the building on their own. That is when the actual project began to take shape.
How much money and time do you have?   smiley-money smiley-money smiley-money
9  Using Arduino / Project Guidance / Re: Token detection. on: April 17, 2014, 07:35:06 pm
I may have misinterpreted the OP's question because I did not see where he said the tokens could be tagged. If they can then
RFID is definitely the simpler solution.
He didn't say ANYTHING about the tokens, or the surface!  Your crystal ball must be malfunctioning... smiley
10  Using Arduino / Project Guidance / Re: Bytes to ASCII on: April 17, 2014, 07:22:19 pm
I think there is something in your code that causes it.
Serial.print does not translate it to a string,
That would depend on whether he's printing (80) or ("80").
11  Using Arduino / Project Guidance / Re: OCR Sorting Machine on: April 17, 2014, 07:11:46 pm
They are all the exact same size. Just have different markings on them.
What size are the beads? What shape are the beads (spherical, disk, etc)? Are they the sort of size markers that clip onto the hanger?
12  Using Arduino / Programming Questions / Re: Relay -why it acts the other way - help needed! on: April 16, 2014, 11:11:16 pm
It seems like the NO and NC markings on the relay are reversed. Connect your load to the contact marked NC instead of the one marked NO.
13  Using Arduino / Project Guidance / Re: Sending DIY code through IR on: April 16, 2014, 10:44:29 pm
Theoretically 1023, practicably a lot less. With 5% resistors, (two resistors = possible 10% error) around 100. Expensive 1% resistors will give more possible combinations.
Thank you Henry! Do you know if this has ever been done before and they have some test results?
Plenty of projects use an analog pin to measure voltage. All I'm suggesting is you input a set voltage (using resistors) and measure it, to give you the identity of the arduino/train. Map the reading on A0 to 0-99, ignore 0 (as that could be a fault) and use that as your train identifier. How many trains do you want? Your original post said just a couple!
14  Using Arduino / Project Guidance / Re: OCR Sorting Machine on: April 16, 2014, 10:00:15 pm
So I have these size beads (s,m,l,xl,xxl)
Do you mean the beads are of different sizes or are they all the same size with different markings (s,m,l,xl,xxl)?
15  Using Arduino / Project Guidance / Re: OCR Sorting Machine on: April 16, 2014, 09:52:45 pm
Scanning a round object, rendering a flat field view and OCR is not a simple feat, IMO.
Damn near impossible, I'd say. Why not use a series of sieves to sort them on their size?
Pages: [1] 2 3 ... 73