Show Posts
Pages: 1 ... 2249 2250 [2251] 2252 2253 ... 3234
33751  Using Arduino / Project Guidance / Re: Which Arduino for USB? on: October 11, 2011, 08:36:20 am
Quote
suspected as much!
Probably wasn't using a cell phone GPS, either.
33752  Using Arduino / Project Guidance / Re: Passing int array to loop() from setup() on: October 11, 2011, 08:34:08 am
Quote
My question to you is how do you pass an array from a function to the other?
Passing a function to an array is not the difficult part. The setup() function does not call loop(), though, so you can not make setup() pass an array to loop().

You can define the array globally (before setup()), so that both functions have access to the same array. Initialize it in setup(), and use it in loop().
33753  Using Arduino / Programming Questions / Re: Sweeping servo program question on: October 11, 2011, 08:14:41 am
The value in the write() call IS the angle to turn to, so I don't understand your difficulty.

The Serial.read() function reads bytes, which can hold a value between 0 and 255. So, the simplest thing is for the PC to send the new value to go to as a byte, not a string. Then, simply call Servo.write() with the value read from the serial port. The PC app should also send an ID to define which servo the value is for.

Something like this would work on the Arduino, then.

Code:
Servo pan;
Servo tlt;

void loop()
{
   if(Serial.available() > 1) // Need two bytes ('T' & n or 'P' & n)
   {
      char which = Serial.read();
      int thePos = Serial.read();

      if(which == 'T')
         tlt.write(thePos);
      else if(which == 'P')
         pan.write(thePos);
   }
}
33754  Using Arduino / Programming Questions / Re: Timer1 Not Working on: October 11, 2011, 07:33:04 am
bool variables are byte sized, so they can be set to 0, LOW (alias for 0), true (another alias), false (also an alias), HIGH (another alias), 1, 17, etc.

Normally, they are reserved for true/false, but that is simply a convention.
33755  Using Arduino / Project Guidance / Re: Which Arduino for USB? on: October 11, 2011, 07:30:24 am
Quote
so a stream of millimetre accuracy changes from the GPS would be generally redundant.
Dream on.
33756  Using Arduino / Project Guidance / Re: Xbee with Arduino on: October 11, 2011, 07:14:26 am
Quote
I am using xbees with arduino they are communicating through X-CTU
Which XBees? How are they communicating through X-CTU? Specifically, how are you validating that two XBees are sending/receiving data.

Are you using shields? Which ones?

Quote
Have to run a mic and a motor wirelessly, it will be really helpful if someone could suggest some tutorial.
The XBees replace wires. They have absolutely nothing to do with what data you send between the two Arduinos or what those Arduinos do with that data.
33757  Using Arduino / Programming Questions / Re: Timer1 Not Working on: October 11, 2011, 06:44:15 am
Quote
I learnt the difference between int long etc but forgot, I need to have a readup on it.
Integer types hold whole numbers. Floating point types can hold fractional values, too.

0.5 is NOT a whole number. When stored in an int, the fractional part is lost, leaving you with a circumference of 0. I do hope you don't divide by the circumference somewhere. At least not until you use the correct variable type.
33758  Using Arduino / Programming Questions / Re: IR Thermometer MLX90614 on: October 11, 2011, 06:27:24 am
Quote
I copied the I2C master in the library directory und I imported the wire library and the i2c library into my wiring environment.
Why?

From the page you linked:
Quote
The standard wire library wasn’t working for people, so we will be using the i2cmaster library instead.
Does the word instead mean something different to you than it means to the rest of us?
33759  Using Arduino / Programming Questions / Re: Compare value to array on: October 11, 2011, 06:19:31 am
Quote
Give a man a fish and he is fed for a day, teach him how to fish and he is fed for life.
Or until the fish are all gone.
33760  Using Arduino / Programming Questions / Re: reading push button at any time HELP on: October 11, 2011, 06:16:06 am
Quote
what i need is a way to pull digital pin 4 HIGH and leave it HIGH until it is read.
You need external hardware for this. Look at flip-flops.
33761  Using Arduino / Programming Questions / Re: Timer1 Not Working on: October 11, 2011, 06:14:32 am
Quote
However because there is no debugger in the Arduino IDE I can't work out what is going wrong.
The Arduino IDE has an icon tagged Serial Monitor.

Add Serial.begin(9600); to setup. Add Serial.print() statements to loop(). Compile and upload. Then, press the Serial Monitor icon. The Serial Monitor will open, and you can see your print()-ed output.

Code:
const long circumference = 0.5; //0.5 metre bike wheel circumference
Long is 16 bit integer. Do you know the difference between an integer and a float/double?

The real reason for using Timer1 instead of millis() or micros() is so that you can have code called automatically at exact times. If you are not registering a callback (and you aren't), the TimerOne class is not really what you want to be using.
33762  Using Arduino / Programming Questions / Re: How To Pause Timer1 on: October 11, 2011, 06:06:43 am
Quote
If it's object oriented, then how come on this page you don't need to create an instance:
http://www.arduino.cc/playground/Code/Timer1
Classes can have static methods. Static methods do not need a class instance to be called for.

Quote
Timer1 timer = new Timer1();
By default, the Arduino does not implement the new operator. Even if it did, the new operator returns a pointer. You are not trying to store the pointer in a pointer variable.

Quote
it said: "Timer1 does not name a type"
Have you looked at the source code? The class is called TimerOne. The header file declares an instance of that class called Timer1.

It is that instance of the class that you are using, whether you are aware of it, or not.

What does the rest of your code look like? How is the switch you are using wired?
33763  Using Arduino / Programming Questions / Re: reading push button at any time HELP on: October 11, 2011, 05:45:57 am
Quote
This is my latest code, the push button decrementer works but only if pushed at certain times, if i had a typical on/off switch that stays in a position until switched again then i think i could figure it out,
anyone with any idea how to make it work with the MOM switch?
Some test code to get this functionality working would NOT take 3 posts to get it all in. Start a new sketch to just read the switch state, and decrement a counter when the switch transitions from HIGH to LOW or LOW to HIGH, depending on how the switch is wired and whether you want the count to decrement on pressed or on released.
33764  Using Arduino / Project Guidance / Re: Project Help on: October 11, 2011, 05:31:01 am
This is your third thread on the same topic. Are you going to listen here?
33765  Using Arduino / Project Guidance / Re: controlling osc pitch with usb tablet school project on: October 11, 2011, 05:25:36 am
Quote
I want to  control pitch and maybe tone sustain from an osc with an usb tablet through max/msp.
Excuse me. What is the Arduino going to be doing? Listening to the music and dancing?

Quote
I reckon i need to setup the osc with arduino
We don't do hill-billy here. Once more in English, please.

Quote
maybe tell me if this is at all possible!
If what is possible? I can't figure out what you want the Arduino to do.
Pages: 1 ... 2249 2250 [2251] 2252 2253 ... 3234