Show Posts
Pages: 1 ... 246 247 [248] 249 250 ... 844
3706  Using Arduino / Project Guidance / Re: Allow Users to upload plugins on: November 06, 2013, 10:00:47 am
If you only need to alter configuration/data then store it in EEPROM and provide a means to change it e.g. based on commands received over the serial port. This might be sufficient if you only want to configure/activate a set of plugins which are fixed and hard-coded in your sketch.

If you need to provide arbitrary behaviour then Bitlash scripts would be a good way to do it, but you would somewhere to store the bitlash scripts.
3707  Using Arduino / Project Guidance / Re: Immobilizer (suggestion needed on "remote"). on: November 06, 2013, 09:55:52 am
If you're concerned about security, are you also going to have a steering lock? Are you going to provide strong security and anti-replay attacks on whatever wireless interface you adopt?

Making a good security system is hard. Making a bad one is pointless.
3708  Using Arduino / Project Guidance / Re: Create a password with buttons on: November 06, 2013, 09:49:34 am
Write some code to detect when a given button is pressed.

Write some code to wait until no buttons are pressed and then wait until one button is pressed and return a number indicating which button was pressed. If your buttons are represented as pin numbers in an array then the array index number would be the obvious way to represent the button's identity.

Write some code to decide when to start entering a code, and then wait for the required number of button presses to occur, and save each button press in an array. At the end of this activity, the array contains your 'password'.
3709  Using Arduino / Programming Questions / Re: code problems.. on: November 06, 2013, 09:46:28 am
I suggest you just hold hours, minutes and seconds in separate integer variables and use snprintf() to format them to a string when you want to print them.

I also suggest you don't use delay to control the speed of your sketch. Check the value of millis() and when it shows that 1000 milliseconds have elapsed, increment your second counter:

unsigned long lastTime = 0;
const unsigned long ONE_SECOND = 1000;
if(millis() - lastTime >= ONE_SECOND)
    // one second has elapsed
    lastTime += ONE_SECOND;

Here, handleElapsedSecond() would contain whatever logic you need to calculate the new time and update the display etc.
3710  Using Arduino / Project Guidance / Re: I want my stepper motor to switch speed while traveling on: November 06, 2013, 09:39:52 am
Is it part of another library?

No, it's just a variable that you set to a value to record what state you're in, so that you can perform the logic that needs to be performed in that state. The snippet I posted was supposed to demonstrate the concept.

(The term you were looking for is finite state machine.)
3711  Using Arduino / Project Guidance / Re: Arduino Serial Communication 16Mhz to 8Mhz on: November 06, 2013, 09:34:17 am
doubling the baud rate at the 8Mhz end fixes it..

That suggests that your boards settings are wrong (wrong clock speed selected). Perhaps you selected the wrong board type, or that board type is not defined correctly. Don't be surprised if millis() and micros() give the wrong answer too. It would be better to correct the problem rather than work around it.
3712  Using Arduino / Project Guidance / Re: help with sound localization on: November 06, 2013, 09:24:41 am
Does anyone have previous experience implementing phase difference based sound localization in Arduino?

That's not what you're doing here - you're just comparing amplitudes. That would be viable if your microphones were sufficiently directional and the angle between them was set accordingly.

Have you actually tested how directional your microphones are? If not, I suggest you do that. It just needs a sound source and a sketch that prints out sound levels at regular intervals while you change the orientation of the microphone relative to the sound source. This will tell you whether you have a hope in hell of using that effect to determine the bearing to the sound source.
3713  Using Arduino / Project Guidance / Re: Help with a project, getting RPM from a belt system. on: November 06, 2013, 09:18:11 am
hmm that should work actually, I would just need to figure out how to make it work in inverse, so that it counts when the beam is reflected not interrupted

You probably want to have another think about what you wrote there. smiley
3714  Using Arduino / Project Guidance / Re: Overpriced Ink with an RFID... on: November 05, 2013, 09:54:39 pm
Have you confirmed that the RFID tag is actually being read by the printer and is not just something to do with stock keeping or anti-theft? Presumably you could confirm that very quickly just by removing the tag and confirm that the reel is then not recognised.

Then have you confirmed that the tag is being altered by the printer? You could do that by reading the tag on a 'new' reel and then reading the tag on a 'used' reel and seeing whether the tag is being altered. It may be that the tag is just telling the printer what type/quantity of paper is installed, or something.
3715  Using Arduino / Project Guidance / Re: rc car, arduino, and tb6612fng.. having trouble. on: November 05, 2013, 09:48:38 pm
if (distance >= maximumRange || distance <= minimumRange){
  move(1, 128, 0); //motor 1, half speed, reverse
  move(2, 255, 1); //motor 2, full speed, right

  delay(3000); //go for 3 seconds
  stop(); //stop
  delay(250); //hold for 250ms until move again

Does the expression in that if statement accurately reflect when you want the reversing to occur, i.e. when the distance is outside the range minimumRange .. maximumRange ?

If so, is the code inside that 'if' statement being executed when that situation occurs?
3716  Using Arduino / Programming Questions / Re: creating an averaging function correctly on: November 05, 2013, 08:55:46 pm
the int type

It is always necessary to choose the appropriate data type, and 'integer' doesn't necessarily mean 'int'.
3717  Using Arduino / Programming Questions / Re: Problem with SoftWareSerial on: November 05, 2013, 07:14:51 pm
You're writing binary data including nulls - I think you want to use CamSerial.write(), not CamSerial.print().

The serial port speed may also be part of your problems. Although the documentation suggests that it supports speeds up to 115200 bps, in practice the higher the speed the more sensitive comms are to timing glitches, and you might find it won't actually work reliably at speeds that high in your application.

The readBytes(char *, int) you're using to read back the response isn't documented and isn't implemented in the copy of SoftwareSerial in my 1.0.4 installation. What does it do? In particular, what does it do if the number of bytes available to be read is less than the second argument?
3718  Using Arduino / Programming Questions / Re: creating an averaging function correctly on: November 05, 2013, 07:05:27 pm
I would say that a more obvious implementation using integer variables would be:

average = ((9 * average) + (1 * newValue)) / 10;
3719  Using Arduino / Programming Questions / Re: Order of functions and function prototypes? on: November 05, 2013, 06:59:49 pm
The compiler doesn't seem to care whether the included sketch is called .ino, .cpp or .h

The compiler cares a great deal, which is why you're having the problems you're having.

I'm lazy. If it works (and it seems to) it will do. I never liked the fragmentation of C projects into so many files that make it almost impossible to figure out easily what anything is.

What I described is a standard conventional 'C'/C++ structure, which is how the language was designed to be used and works on projects of all sizes. The approach you described is a nasty hack which can be made to work but is not a good approach.

How should I include a file that is not in the current directory?

If you're building it using the Arduino IDE, put it in a library. Your other option is to not use the Arduino IDE.
3720  Using Arduino / Programming Questions / Re: help with PWM soft motor pull timing on: November 05, 2013, 06:55:42 pm
Well that all seems perfectly feasible. If you use one Arduino per bell your basic sketch will be simpler but you will need a scheme to get them all started in synch. Do you have a scheme for that? (For example, power them all from a common wall socket so you can switch them on together.)
Pages: 1 ... 246 247 [248] 249 250 ... 844