Show Posts
Pages: 1 [2] 3 4 ... 40
16  Forum 2005-2010 (read only) / Syntax & Programs / Re: Basic Upload Error on: May 01, 2009, 07:06:50 pm
please tell us:
- operating system you used
- version of Arduino software
- Arduino hardware name?

for example:
Mac OS X, 0015, Arduino Diecimila

and in that case: uninstall the FTDI chip drivers (search the forum for it) and then install the latest FTDI chip drivers (again, search the forum)

It is a communication error and can be caused by different things. Your code is ok and the size is no problem.
17  Forum 2005-2010 (read only) / Syntax & Programs / Re: Interrupt funtion with delay() on: May 01, 2009, 04:13:41 pm
Don't use the delay() function in an interrupt routine!
It relies on interrupts itself.

The delayMicroseconds() function in contrast uses a simple wait loop and disables interrupts before execution (and then restores SREG after execution), so you can use it in interrupt routines.

For details have a look here:
http://code.google.com/p/arduino/source/browse/tags/0015/hardware/cores/arduino/wiring.c
18  Forum 2005-2010 (read only) / Syntax & Programs / Re: Fail Safe on: March 31, 2009, 07:34:58 pm
you can use the watchdog (timer). This will reset the mcu and thus restart the sketch...
19  Forum 2005-2010 (read only) / Syntax & Programs / Re: Making an arduino sketch into multiple piece on: March 25, 2009, 07:23:10 am
It is ok to use classes in the sketch as this is a c++ context.

You can also create a library with the .c and .cpp files and use this library in the sketch. This makes sense if the class does something useful that is not limited to you special sketch but can be reused in other projects.
20  Forum 2005-2010 (read only) / Syntax & Programs / Re: help on: March 22, 2009, 09:44:59 pm
For the software, have a look at:
http://www.arduino.cc/en/Reference/Servo

for the 9V:
use an external power supply that provides 9V and connect it to the 9V (red?) and the 0V or GND wire (black?) of your servo.
Connect the third wire of your servo to pin 9 or 10 of the Arduino.

I would not recommend to drive the Servo via the 5V of the Arduino. And you can't get 9V out of the Arduino...

Don't forget to connect the ground of the Servo with the GND pin of your Arduino.

21  Forum 2005-2010 (read only) / Syntax & Programs / Re: Help with simple interrupt on: March 10, 2009, 06:30:45 am
You did not say what you want to do... do you want to dim the LED connected to the OC1A pin?

Then maybe you want to toggle the pin on each OC event:
Code:
TCCR1A |= (1 << COM1A0);

without this line of code, the  OC1A pin is not connected to the timer outout...

and of course you want to set OCR1A to the desired value in your ISR again...


22  Forum 2005-2010 (read only) / Syntax & Programs / Re: 120 khz with arduino on: March 09, 2009, 07:53:42 pm
There is no function that waits shorter than microseconds, sorry.

But you can wait with
asm volatile("nop");

and with my Arduino Diecimila (atmega168 at 16MHz)
the following code is gets very close to 120kHz:

Code:
uint8_t outPin = 2;

void setup()
{
  pinMode(outPin, OUTPUT);
  digitalWrite(outPin, LOW);
}

void loop()
{
  digitalWrite(outPin, HIGH);   // sets the pin on
  asm volatile("nop");
  asm volatile("nop");
  asm volatile("nop");
  asm volatile("nop");
  asm volatile("nop");
  asm volatile("nop");
  asm volatile("nop");
  digitalWrite(outPin, LOW);    // sets the pin off
  asm volatile("nop");
  asm volatile("nop");
  asm volatile("nop");
  asm volatile("nop");
  asm volatile("nop");
  asm volatile("nop");
  asm volatile("nop");
}

maybe on your hardware you must try more or less of the nop expressions... and I do not recommend this solution. A timer would be the better choice, but you asked for a software solution.

Oh and your Arduino should do nothing else while he is running this code... why do you need this 120kHz?
23  Forum 2005-2010 (read only) / Syntax & Programs / Re: 120 khz with arduino on: March 07, 2009, 12:12:06 pm
Quote
Please help i know that there is someway to do this in software.
in software means that you don't want to use the hardware timers?

Have a look at http://arduino.cc/en/Reference/DelayMicroseconds
replace the value 50 in the two lines delayMicroseconds(50); by a value that fits your needs, e.g.: delayMicroseconds(1);
and measure the frequency on the output pin... modify the value until you read 120kHz. On my Arduino I can't get better than 108kHz with this software solution.

Maybe you consider using a hardware timer (e.g. timer1) for your problem?
24  Forum 2005-2010 (read only) / Syntax & Programs / Re: Fade IN and Fade OUT with Button on: March 09, 2009, 05:16:58 pm
Sorry, I did not scroll to the bottom of your code and missed these lines:

Code:
if (state == 1) {      
    analogWrite(LED, brightness); // turn LED ON at the current i level
  } else {
    analogWrite(LED, 0); // turn LED OFF
  }

so you are using analogWrite()... simply move the code block to the place where you set the brightness and your code should work.

So after
Code:
brightness = i;

you must do the analogWrite()
25  Forum 2005-2010 (read only) / Syntax & Programs / Re: Fade IN and Fade OUT with Button on: March 09, 2009, 05:12:20 pm
You could use the analogWrite() function and connect the LED to a pin that supports pwm. (For this: see you Sketchbook: Examples->Analog->Fading)

Or if you don't want to use pwm, you can try the following code:
Code:
uint8_t ledPin = 8;

uint8_t brightness;
uint8_t counter;

void setup()
{
  pinMode(ledPin, OUTPUT);
}

void loop()
{
  for(brightness = 0; brightness<255; brightness++)
  {
    for(counter = 0; counter <255; counter++)
    {
      digitalWrite(ledPin, counter<brightness);
    }
    delay(1);

  }

  for(brightness = 255; brightness>0; brightness--)
  {
    for(counter = 0; counter <255; counter++)
    {
      digitalWrite(ledPin, counter<brightness);
    }
    delay(1);
  }
}

the counter variable is used to divide time into 256 time slots. In each time slot the LED can be on or off.
Example: brightness = 100
then the led is on for the first 100 time slots and off for the remaining 155 time slots.

By increasing brightness (outer loop) from 0 to 255 and then decreasing it, the LED is fading.

delay(1); makes sure that this fading isn't too fast. If you need a slower fading, simply change the delay value.
26  Forum 2005-2010 (read only) / Interfacing / Re: is it possible ti use C# to program the Arduino bo on: March 28, 2009, 04:17:17 pm
arduino uses the gcc compiler. There does not exist a c# compiler for the atmega microcontroller yet. Not even the full feature set of C++ is supported by this hardware platform, because object oriented programming languages require more ressources than current simple eight bit mcus do offer. So programming the Arduino hardware with C# is not an option.

Programming a GUI that communicates with an Arduino is something different and it makes sense. You can even think about a WebService that runs on the Arduino (with an Ethernet shield) and integrate this WebService into your Visual Studio. I did this for different embedded systems platforms. This makes the Arduino feel as a part of the .NET environment. For example you could write a WebService that controls 8 digital I/O ports and use it in a C# program.
Maybe have a look into the Microsoft Robotics Studio and see how they do the hardware abstraction.

Or as mentioned before, you can use simple serial communication.
27  Forum 2005-2010 (read only) / Interfacing / Re: Programm arduino using blue smirf on: April 30, 2009, 10:44:28 am
you can try to change the baud rate in the bootloader sources and then compile your own bootloader and upload it to the board via ISP.

In the Makefile of the bootloader you want to specify the baudrate for the corresponding target board. To get an idea how this works search for
Code:
-DBAUD_RATE=57600
in the Makefile ( http://code.google.com/p/arduino/source/browse/tags/0015/hardware/bootloaders/atmega/Makefile )

if no baud rate is specified then the default is 19200 (see http://code.google.com/p/arduino/source/browse/tags/0015/hardware/bootloaders/atmega/ATmegaBOOT_168.c )

Just to make things a little bit clearer: this changes the baudrate of the bootloader on your Arduino Pro Mini if you upload it to the board. Then you must also change the baud rate (speed) setting in the boards.txt to the same value.

And don't get confused by the ISPSPEED key in the Makefile, this is the baudrate for the ISP interface (e.g. stk500v2) and has nothing to do with the baudrate setting of the bootloader that you want to change.
28  Forum 2005-2010 (read only) / Interfacing / Re: Programm arduino using blue smirf on: April 29, 2009, 07:28:33 am
I looked into this file:
http://code.google.com/p/arduino/source/browse/tags/0015/hardware/boards.txt

and I see: 19200 baud for most boards... it seems as if the new chips use 57600 baud for the bootloader... so: did you connect the blue smirf using the correct baud rate?
29  Forum 2005-2010 (read only) / Interfacing / Re: How Arduino talks to Ableton? on: July 29, 2009, 07:16:43 pm
Maybe you can tell us more about your setup?
The Arduino generates MIDI commands, ok. Are you sending these commands via USB or did you create a MIDI-OUT hardware?

If you do it in software, then you need to find a way to route the midi commands to ableton live. One way would be to use a "virtual midi cable". I use "Maple Midi" on Windows.
You need to have another piece of software to bridge the USB messages from the Arduino to the virtual MIDI cable.

If you have a mac then this might be what you are looking for:
http://code.google.com/p/ardrumo/
30  Forum 2005-2010 (read only) / Interfacing / Re: Really Simple Instructions: arduino to Flash on: March 29, 2009, 08:25:46 am
Did you have a look at this:
http://www.arduino.cc/playground/Interfacing/Flash
and maybe this:
http://code.rancidbacon.com/Flashduino
Pages: 1 [2] 3 4 ... 40