Show Posts
Pages: [1] 2 3 ... 5
1  Using Arduino / Programming Questions / Re: taking average of n sample on: January 14, 2013, 10:00:38 am
Can some one suggest me simple code for taking average of n sample of arduino  analog signal.

assume that i have analog sensor, whenever i very output, the reading should get recorded and should return average of n sample recorded



Hi,
consider using the moving average (http://en.wikipedia.org/wiki/Moving_average) if you want to continously compute the average of the last N samples.

2  Community / Exhibition / Gallery / Re: Magnetic levitation on: December 29, 2012, 10:14:31 am
Quote
Very cool!    Where did you get the electromagnet?

Hello, I bought the electromagnet and magnetic sphere here:

http://zeltom.com/products/magneticlevitation/emlscomponents

they sell a complete magnetic levitation kit (not based on Arduino) or single components.
3  Using Arduino / Project Guidance / Re: Nikon D700/800 shutter release with 4N25 on: October 19, 2012, 09:42:50 am
Quote
I think the problem was with the 4N25's, not the D13 pin

Did you try to swap the connections with pins 4 and 5 of the optocoupler? maybe the pullup resistor on the camera is on the other side.
4  Using Arduino / Programming Questions / Re: bcdToDec on: October 19, 2012, 08:28:27 am

BCD means Binary Coded Decimal, is different from binary representation:

http://it.wikipedia.org/wiki/Binary-coded_decimal
5  Using Arduino / Project Guidance / Re: Seeking advice on photoresistor led sequence project on: October 18, 2012, 05:29:13 am
Hello cisco87,
you can simply trigger the sequence by reading the photoresistor:

Code:

void loop()                     
{
  int lightLevel = analogRead(lightPin);

  // ...

  if( lightLevel < lowThreshold )
  {
     inAndOut();         
  }
  else
  {
     // ...
  }
}

consider that the analog channel is read when the "inAndOut" function completes its execution, once evey 6*100 = 600 millisec.
6  Using Arduino / Project Guidance / Re: Nikon D700/800 shutter release with 4N25 on: October 17, 2012, 04:33:53 am

Hi,
I did the same thing for my Canon 450D and it works. I see from this site:

http://www.hiviz.com/kits/instructions/rsr_inst.htm

that the Nikon cable is different from the one in your picture. In any case, did you try to short circuit the focus and ground pins without any optoisolator?

7  Using Arduino / Project Guidance / Re: Lighting Lots of 1.2v Bulbs...or Bright LEDs on: October 16, 2012, 08:38:15 am

Hi,
you probably need a shift register, as explained here:

http://arduino.cc/en/Tutorial/ShiftOut

8  Using Arduino / Project Guidance / Re: Interfacing arduino to Power Point on: October 06, 2012, 10:51:16 am
Quote
Is there a way where I can do something using C++, and which languages would you recommend I learn for being able to interface embedded hardware with windows or other operating systems, where I can control the programs in the OS using the hardware I build

Yes, you can program in C++ but some knowledge of Windows environment is necessary (WIN32, MFC, COM), here is explained how to do an MFC application to automate Power Point using MFC (Microsoft Foundation Classes):

http://support.microsoft.com/kb/237554/en-us?fr=1

If you learn how to open a serial port on Windows and read/write data, you can easily create a communication link between Arduino and a client application on the PC.
If you already know C++ and object oriented programming, I suggest you to learn C# language for programming Windows applications.
 
9  Using Arduino / Project Guidance / Re: Interfacing arduino to Power Point on: October 05, 2012, 07:56:26 am
Quote
Now I know arudino can send data to the serial port of the pc, but how can I interface the serial port to power point?

Hi,
if you know any .NET programming language (i.e. VB, C#) there is an easy way for controlling a power point presentation from code:

Code:
         string presPath = "c:/Temp/test_pps.ppt";
         //Create an instance of PowerPoint.
         Microsoft.Office.Interop.PowerPoint.Application app = new Microsoft.Office.Interop.PowerPoint.Application();

         // Show PowerPoint.
         app.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;

         // Open a presentation.
         Microsoft.Office.Interop.PowerPoint.Presentations ppPres = app.Presentations;
         Microsoft.Office.Interop.PowerPoint.Presentation pres = ppPres.Open(presPath, MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);

         // Show presentation.
         pres.SlideShowSettings.Run();

// Here read a command from serial port (for example the ASCII char 'N' for next and 'P' for previous) and call
// pres.SlideShowWindow.View.Next(); or pres.SlideShowWindow.View.Next();


The previous code is in C# and some exception control should be added but is an example.

10  Using Arduino / Programming Questions / Re: Arduino and BV20 Bill Acceptor/Validator on: October 01, 2012, 09:09:29 am
Quote
After I inserted a $5 bill that's what I got in Serial Monitor:

Code:
-2726
12526
20487
31807
-21701
-7533
5954
18410
31594
-20286
-7357
5292
16138

One line every 3 seconds.

these numbers probably are due to the fact that a lot of interrupts are received and the gCount variable reachs the maximum (32767) and rolls over with negative numbers. Have you got an oscilloscope to verify the output line of your device?
11  Using Arduino / Programming Questions / Re: Arduino and BV20 Bill Acceptor/Validator on: October 01, 2012, 03:28:17 am
Hi,
your hardware setup should be:
Code:
//                  o +5V
//                  |
//                  R = 2200 ohm               
//                  |
//   BV out o-------+-------o Arduino in
//

and I suggest you try to monitor the digital edges count:
Code:
volatile int gCount = 0;
unsigned long gMillisCounter;

void setup()
{
  Serial.begin(9600);
  attachInterrupt(0, pulseCounter, FALLING); // On digital pin 2
  gMillisCounter = millis();
}

void loop()
{
  // Print gCount every 3 seconds
  if( (signed long)( millis() - gMillisCounter ) >= 0)
  {   
    gMillisCounter += 3000;
   
    Serial.println(gCount);   
  }
}

void pulseCounter()
{
  gCount ++;
}
12  Using Arduino / Programming Questions / Re: Does the Arduino clock frequency affect analogRead()? on: October 01, 2012, 01:40:20 am
Hi,
are you sure the equation for calculating the resistance is correct? From the schematics in your code:

Code:
// Configuration:
// 5v------10k-------Sensor------GND
//               |
//            Analog

it should be:

Code:
float aread = 5.0 * (analogRead(0) / 1024.0) // voltage in Volts
float resistance = (10000 * aread) / (5.0 - aread); // resistance in ohm
13  Using Arduino / Programming Questions / Re: float type format on: September 26, 2012, 02:05:41 pm
Hi fnsnoop,
if the println function expects a NULL terminated string as parameter, this code
Code:
Serial.println((char *)&number);
can give problems because you are pointing a memory area whose content, after the 4 bytes of the number variable, in unknown.
14  Using Arduino / Programming Questions / Re: Convert Fixed-point to actual value(decimal) on: September 26, 2012, 01:36:35 pm
Hi,
if I have understood, you want to store the "actual value", in the range (0.0, 150.0), into a 32 bit integer with three decimal points by multiplying this number by 1000. Therefore you have an integer number in the range (0, 150000). An unsigned integer, 32 bit, can store any number between 0 and 4294967295, so I don't see any problem.
15  Using Arduino / Programming Questions / Re: Problem with a custom library on: September 26, 2012, 04:32:00 am
Hi hjavaher,
the code you posted is unusual also for the following reasons:
1) usually an header file content is inserted in a define block to avoid multiple inclusions, in this way:
Code:
#ifndef __lib_gravity__
#define __lib_gravity__
.....
#endif
but the define directive is missing.
2) why are you including .c files in a header?

Pages: [1] 2 3 ... 5