Show Posts
Pages: 1 ... 2251 2252 [2253] 2254 2255 ... 3072
33781  Using Arduino / Project Guidance / Re: Making Things Talk - Components Kit? on: July 07, 2011, 07:35:16 am
There are a huge number of projects in that book, with a substantial price list if one were to collect ALL the parts referenced. I picked the projects that interested me, and collected the parts needed for those projects. I suspect most people do the same.
33782  Using Arduino / Networking, Protocols, and Devices / Re: Serial over TX pin Arduino UNO on: July 07, 2011, 05:58:56 am
Quote
Have yet to obtain a multi-meter.
Get a box and a roll of tape. Put the Arduino in the box, along with the wall-warts and everything else. Tape the box shut. Put it away.

When you get the multi-meter, you can get the box back out and open it. Until then, DON'T.
33783  Using Arduino / Programming Questions / Re: Run two commands at the same time. on: July 07, 2011, 05:32:17 am
Do you multi-task? Probably.

Can you type and play the guitar at the same time? Well, unless you are not normal, no.

But YOU could do what you are asking the Arduino to do, and if you can, the Arduino can.

It simply requires a little different mindset.

What you are looking to create is a state machine, with transitions between the states causing certain actions to occur.

Make a list of the states that you would have to deal with. PIR sensing motion. PIR not sensing motion. Thermistor is cold. Thermistor is hot.

Now make a list of the things that trigger a change from one state to another. You read the PIR and see that it is HIGH and was NOT, or is LOW and was not. You read the thermistor temperature and it is above a threshold and was not, or it below a threshold and was not.

Now, define what happens when a state transition is required. For instance, if the PIR was not sensing motion, and it is now, you need to turn a light on, and record when that happened. Or, the temperature went above the threshold, so you turn a fan on. Or the temperature went below a threshold, so you turn the fan off.

You'll see that some states have a time element (PIR not sensing motion and light is on) and some do not (man, it's cold in here). So, some transitions occur when enough time has elapsed.

So, on each pass through loop, you determine whether a transition is required (it got hot enough, it got cold enough, the PIR sensed motion, etc.) based on sensor input. If so, you perform the required transition. Then, you determine if any time-based transitions are required (PIR not sensing motion and the light is on and has been for 30 seconds, for instance). If so, you perform the transition (turn the damned light off, I'm not made of money).

All of these things are easily performed by the Arduino. No multi-tasking required.
33784  Using Arduino / Programming Questions / Re: Arduino - Servo - On startup servo motor moves to default position too fast! on: July 07, 2011, 05:04:54 am
If you add a pushbutton, and some code to remember where the servo is, you could store the servo position in EEPROM when the button was pressed.

On startup, read where the servo was last positioned (from EEPROM), and set that as the current position, before attaching the servo. Then, the servo won't jump to its "proper" position, and you can move it at whatever speed you like to the start position.
33785  Using Arduino / Programming Questions / Re: Stop codes from execute on: July 07, 2011, 04:52:22 am
I am trying to build a water top-off system for the fish tank and wanted the program to "shut-down" (i.e stop the pump) when something go wrong
Stopping the program from doing anything and stopping the pump are two completely different tasks.

If you put code in that stops the program from doing anything, any pins that were LOW will stay LOW. Any pins that were HIGH will stay HIGH.

So, your pump that is pumping water all over the floor will continue to pump water all over the floor.

If that's what you want, post the code, and we'll help you figure out how to do that.

If it's not, you need to NOT stop the program from reading inputs, and, instead, make it aware that there is a problem (i.e. have it check some water level sensor), and have it take action to stop the problem (i.e. shut off the pump).
33786  Using Arduino / Programming Questions / Re: wii motion plus output to servo on: July 07, 2011, 04:36:50 am
Quote
The problem now is that the servo is not steady when the mplus is not moved.
Look at your receiveData function. You request 6 bytes. Then, you assume that you get 6 bytes. Do you really?

Serial.print() the value of roll. Does it hold still then the remote does? If so, there is no reason to write to the servo again. If not, well, then, the problem isn't with the servo.


33787  Using Arduino / Programming Questions / Re: arduino duiminalove programming using header and source code files on: July 07, 2011, 04:30:48 am
Quote
i don't know how to integrate those header and source files into a arduino duiminalove ATMEGA328
Perhaps you might have taken the time and trouble to look at the example provided.
33788  Using Arduino / Programming Questions / Re: PCF8574P and his output on: July 07, 2011, 04:27:58 am
Quote
I have 8 leds connected to the PCF
So, observe what happens if you execute this loop:
Code:
for(int i=0; i<8; i++)
{
  Wire.beginTransmission (x);
  Wire.send (i);
  Wire.endTransmission ();
  delay(250);
}
Where x is the address of the chip.
If you have the LEDs connected correctly, sending 0 to the chip should light no LEDs. Sending 0b00000001 (or 0x01 or 1) should light the 1st LED. Sending 0b00000010 (or 0x02 or 2) should light the 2nd LED.

In general:
Code:
byte b = 0;
bitSet(b, n);
and sending b to the chip should light the nth LED.

To light more than one:
Code:
byte b = 0;
bitSet(b, 2);
bitSet(b, 7);
This should light the 2nd and 7th LEDs.
33789  Using Arduino / Programming Questions / Re: Adafruit / Easy Driver on: July 06, 2011, 04:29:15 pm
Quote
What difference in code would I need to write, to change one sketch from using an easydriver to enable it to use  an adafruit motor shield ??
If the sketch only blinks an LED, none.

If the sketch does more than that, perhaps you could post it.
33790  Using Arduino / Programming Questions / Re: While loop questions. on: July 06, 2011, 04:27:34 pm
If the number of steps in each loop is different, you need to actually create 3 while loops - one for all common values, 1 if loop one is longer, and the third is loop 2 is longer. Of course, you only run two of the 3 loops.
33791  Using Arduino / Project Guidance / Re: Transfering images with Arduino on: July 06, 2011, 10:30:35 am
Quote
And more importantly that any alternative approach is still going to be limited by the serial line transfer and not by any memory shortages?
The approach is first going to be limited by the speed of serial data transfer. IF you overcome that limit, you need to have some data to transfer. Where is that data going to come from? How do you get the data from the camera? Does the entire picture need to be held in memory at one time?

Answers to these questions will determine whether the one minute frame rate is even possible.
33792  Using Arduino / Programming Questions / Re: Printing D18B20 output to lcd to 2 decimal places on: July 06, 2011, 10:24:59 am
Quote
more searching needed....
Or you could post your code...
33793  Using Arduino / Programming Questions / Re: PCF8574P and his output on: July 06, 2011, 10:12:11 am
129 posts and still no links?
33794  Using Arduino / Programming Questions / Re: Printing D18B20 output to lcd to 2 decimal places on: July 06, 2011, 09:38:03 am
Quote
However i know the sensor is capable of better resolution, i just need to get it to my display somehow
You need to match variable types with function output. If sensors.getTempCByIndex() returns an int, you won't get two decimal places of accuracy. If sensors.getTempCByIndex() returns a float, you won't get anywhere truncating that value by storing it in an int.

There are several ways to convert a float to an array of characters. Whether that is even necessary depends on what the lcd object is. If it (correctly) derives (directly or indirectly) from the Print class, it is capable of printing ints and floats directly.

Without seeing more of you code, all we can offer is encouragement. Good luck.
33795  Using Arduino / Programming Questions / Re: Printing D18B20 output to lcd to 2 decimal places on: July 06, 2011, 09:10:57 am
Code snippets lead to lousy answers, generally.

What is the type for temp4? If it is int, you can't expect to print an integer to 2 decimal places. If it is NOT int, why are you using itoa (integer to ascii) to convert it to a string?
Pages: 1 ... 2251 2252 [2253] 2254 2255 ... 3072