Show Posts
Pages: [1] 2 3 ... 24
1  Using Arduino / Programming Questions / Re: Easy question about Arduino syntax, please help!! on: May 22, 2012, 10:11:14 pm
Try this:

Code:
if ((a ^ b) || (a && b)) {
 // do something
}

the ^ is an XOR, the || is OR, and the && is AND.
2  Using Arduino / Programming Questions / Re: Set Pin A6 High (Arduino Nano) on: May 10, 2012, 08:47:50 am
A6 is a dedicated analog input; it is one of the (very few) pins on the ATMega328P microcontroller that can't be used as GPIO (digital input/output).

See here: http://www.atmel.com/Images/8271S.pdf and look at section 1.1.9 for more information.

If you need additional GPIO, you may want to look into using a shift register, such as a 74HC595.
3  Using Arduino / LEDs and Multiplexing / Re: Shift register problem on: April 24, 2012, 01:38:59 pm
Do you have current-limiting resistors on the 7-segment display? You didn't post a datasheet, but many shift registers and similar ICs have a fairly limited capability to supply current. As a result, the voltage output could drop significantly with current load.
4  Using Arduino / Programming Questions / Re: Need to read up to 43 bytes of data, reading incorrectly. on: March 28, 2012, 05:00:55 pm
I think your problem is simpler than that--I'm not aware of any implementation of SoftwareSerial that can handle 115.2 kbaud reliably. Drop the baud rate, or use the hardware serial port for the higher-speed communications.
5  Development / Other Software Development / Re: Code share: some of my util classes on: March 07, 2012, 10:15:44 am
[...]
 (because there is no virtual serial device base class I couldn't get rid of the call to Serial.begin(MIDI_BAUDRATE)).
[...]

You can use the magic of OOP and have an overloaded constructor which takes a HardwareSerial*, so that the usage could be either this:

Code:
MidiOutPort midiOut(&softSerial);

or this:

Code:
MidiOutPort midiOut(&Serial);

completely transparent to the user. In the library implementation, the easiest way to do this is to encapsulate the write() function, forex:

Code:
void write(uint8_t b) {
  if (m_hws != NULL) { // set to null in the softwareserial constructor
    m_hws->write(b);
  } else { // not using hardware serial
    m_ss->write(b);
  }
}
6  Using Arduino / Programming Questions / Re: Help with Dagu Rover 5 on: March 05, 2012, 05:31:44 pm
The Rover 5's two motors may have different characteristics, and thus draw different amounts of current at a given voltage (this is often a result of friction in the gearbox, or other such mechanical issues). If you want them to have the same speed, you will need to use feedback on the speeds of the output shafts (possibly via encoder) as an input to a control loop.
7  Using Arduino / Motors, Mechanics, and Power / Re: Sabertooth Packetized Serial Library on: March 03, 2012, 02:06:15 am
Replace the WProgram.h in the file Sabertooth.h with Arduino.h, and it should work.
8  Using Arduino / Motors, Mechanics, and Power / Re: Source of mechanical parts? on: February 23, 2012, 05:24:55 pm
McMaster-Carr is nice for mechanical parts, albeit somewhat more on the expensive side. They've got a warehouse in LA, so shipping is usually one-day, which is a nice benefit, and their quality is very good.

Other than that, local suppliers are best for hardware--it tends to be heavy and vary in quality, so being able to check it out is nice.
9  Using Arduino / General Electronics / Re: Arduino stop executing the sketch on: February 22, 2012, 07:57:59 pm
If the I2C communication is interrupted, the Arduino will busywait indefinitely for an ack that never comes, which sounds like your problem--make sure that the connections are secure.
10  Using Arduino / Programming Questions / Re: Arduino 1.0 with WIRE (I2C) help on: February 14, 2012, 01:01:28 am
You assume that the bytes will be available when they might not be: though you do busy-wait until the first byte has come in, for subsequent bytes, you just delay(100), which does not guarantee that the data has been transmitted. Remember that I2C allows slaves to clock stretch and thus not transmit data until later.
11  Using Arduino / Programming Questions / Re: Arduino 1.0 with WIRE (I2C) help on: February 13, 2012, 05:35:17 pm
That code won't even compile in Arduino 1.0 -- the Wire.send function is now named Wire.write; and the same goes for Wire.receive / Wire.read
12  Using Arduino / Project Guidance / Re: Need help getting servo and fan to work at the same time... on: February 09, 2012, 11:04:17 pm
No problem--feel free to ask questions at any time.
13  Using Arduino / Project Guidance / Re: Need help getting servo and fan to work at the same time... on: February 09, 2012, 02:47:34 am
The Servo library uses the Timer that generates the PWM output for your fan, so it becomes restricted to binary digital output. You can solve this competition for hardware resources by picking a different PWM pin to run the fan from (The first 8 or so servos will use the same Timer, so there's not much point moving that).
14  Using Arduino / Project Guidance / Re: Parallel IO with fast data transfer to PC? on: February 04, 2012, 08:37:44 pm
The common FTDI USB to serial chips are quite happy until a few megabaud, and I've used mine reliable at 250kbaud for some time now.
15  Using Arduino / Project Guidance / Re: Parallel IO with fast data transfer to PC? on: February 03, 2012, 05:42:03 pm
According to the datasheet, at 16MHz 250000baud has a very low error (supposedly 0%)--it's probably the most reliable high-speed rate you can have.

For the implementation of this device, you should note that the Arduino (Mega) pin layout does NOT match the 8-bit registers that are used to read each pin, so for maximum speed you might want to look into the "direct port manipulation" commands and wire the system that way.
Pages: [1] 2 3 ... 24