Show Posts
Pages: 1 ... 54 55 [56] 57 58 ... 116
826  Using Arduino / Microcontrollers / Re: Does the latest IDE support 644P and 1284P? on: January 07, 2013, 03:14:13 pm
I seem to recall reading somewhere that xmegas were though about but were ditched due to reliability and supply issues.

Also, there is an Arduino IDE spinoff for XMegas:
https://github.com/akafugu/Xmegaduino
But I believe they forked the whole IDE, so it isn't as simple as just a new core.
827  Using Arduino / General Electronics / Re: transistor gate does not respond to arduino on: January 07, 2013, 10:23:11 am
They'll do. Just connect the emitter to ground, the collector to the gate of the MOSFET (and a 10k resistor to +12v), and the base via a 1k resistor to the arduino.
828  Using Arduino / General Electronics / Re: transistor gate does not respond to arduino on: January 07, 2013, 09:38:25 am
You are going to have to post a schematic of how the transistor is wired.
829  Using Arduino / Programming Questions / Re: Why does this work in a .h but not in a .ino? on: January 07, 2013, 05:19:00 am
In recent versions. You need 1.0.3 onwards for this to work (or maybe 1.0.2, I can't remember right now).
So it doesn't. I've been using 1.5 as I have a Due, I guess I assumed the two would be similar.
830  Using Arduino / General Electronics / Re: SFE microSD Breakout woes ... on: January 07, 2013, 05:16:10 am
The begin() function calls card.init() with SPI_HALF_SPEED:

Code:
boolean SDClass::begin(uint8_t csPin) {
  /*

    Performs the initialisation required by the sdfatlib library.

    Return true if initialization succeeds, false otherwise.

   */
  return card.init(SPI_HALF_SPEED, csPin) &&
         volume.init(card) &&
         root.openRoot(volume);
}

Which means it is running too fast. In Windows, if you open the following file (it is slightly different on Mac):
<arduino directory>/libraries/SD/SD.cpp

You will find the begin() function declaration, just change the SPI_HALF_SPEED to 2.

As for the TXB0104, there are breakout boards available ready soldered:
http://www.adafruit.com/products/395 (This is actually the 8 channel version, TXB0108)
http://www.nanocore12.com/products/details/27/4/accessories/breakout-board,-level-shifter,-3v/5v,-14-pin-wide-dip.html (4 channel TXB0104)
831  Using Arduino / Project Guidance / Re: Speedy line follower ( Due/ Raspi/Launchpad, which to use?) on: January 06, 2013, 07:18:17 pm
You wouldn't use the Raspberry Pi for something like that. It runs linux, which is not a real time operating system.
832  Using Arduino / General Electronics / Re: SFE microSD Breakout woes ... on: January 06, 2013, 07:11:07 pm
A sudden thought occured

Try changing this line:
Code:
 if (!card.init(SPI_HALF_SPEED, chipSelect)) {
To:
Code:
 if (!card.init(6, chipSelect)) {

That will slow down the SPI to the slowest possible speed of FCPU/128

If that works, try decreasing the number to 5, then 4, then 3 and so on. Each time it will double the speed.

With simple level converters like these, I was never able to get it to run faster than FCPU/8 (aka SPI_QUARTER_SPEED) reliably. Once i switched to a proper level shifter like the TXB0104, I could get up to the full speed of FCPU/2 (aka SPI_FULL_SPEED).


EDIT:
Just as a side note, the card.init() call initialises the card at FCPU/128, and then at the end of the routine sets it to full speed. This means that the volume.init() call will be running on a an SPI at a much higher freqency than card.init() which could be the reason why it fails at that point.
833  Using Arduino / Microcontrollers / Re: Arduino with Atmega32A core on: January 06, 2013, 04:40:14 pm
http://www.newark.com/atmel/atmega1284p-pu/ic-8bit-mcu-avr-mega-20mhz-44-pdip/dp/68T2560?Ntt=68T2560

$7 doesn't seem that bad for an Atmega1284P. Its £3.80 here in the UK.
834  Using Arduino / Displays / Re: ARDUINO 4DISPLAY SHIELD 160 on: January 06, 2013, 04:29:35 pm
The message to take away from the comment it, first thing to do is Google it...

https://www.google.co.uk/search?q=4Display-Shield-160+arduino

Second result any good?

There is a minor issue with that library in that it doesn't support Arduino 1.0+, but you can make it supporting by opening the file "displayshield4d.cpp" and replacing the line:
Code:
#include "WProgram.h"
with the line:
Code:
#include "Arduino.h"
835  Using Arduino / Displays / Re: lcd.print and lcd.write at one line on: January 06, 2013, 04:24:00 pm
If you don't want to convert to Octal, you can add letters in hex:
Code:
char string[] = "\x30\x31\x32";
is equivalent to:
Code:
char string[] = "123";
is equivalent to (octal):
Code:
char string[] = "\060\061\062";
836  Using Arduino / General Electronics / Re: SFE microSD Breakout woes ... on: January 06, 2013, 04:18:47 pm
If I were you, I would swap which level shifter you are using for DI and CS.

Use:
DI <- TXI (ch2) <- TXO (ch2) <- MOSI
CD <- RXO (ch2) <- RXI (ch2) <- pin4

Goodness knows why Sparkfun gave the signals the names they did  smiley-roll. Basically the mosfet shifter is bidirectional, but it will perform better than the resistor divider and is better suited to the data line, or even better still the clock line, for example:

DO -> TXI (CH1) on LV side -> TXO (CH1) on HV side -> MISO on Uno
GND -> GND
SCK <- TXI (ch2) on LV side <- TXO (ch2) on HV side <- SCK on Uno
VCC <- 3.3V on Uno
DI <- RXO (CH1) on LV side <- RXI (CH1) on HV side <- MOSI on Uno
CS <- RXO (ch2) on LV side <- RXI (ch2) on HV side <- pin 4 on Uno
837  Using Arduino / Programming Questions / Re: Why does this work in a .h but not in a .ino? on: January 06, 2013, 02:47:59 pm
Does this mean that every function prototype I have in an .ino file is worthless and always get's superseded by one created by the IDE?

Wrong! The IDE only creates prototypes for functions in the .ino which do not already have one.

Observe:
Code:
void doState1()
{
  //..some code  same with 2 and 3
}
void doState2()
{
  //..some code
}
void doState3()
{
  //..some code
}

typedef void (*S_Function)();

S_Function State_Functions[] = {
  &doState1, &doState2, &doState3};

S_Function getCallback(int _state); //create function prototype here, and the IDE wont add one at the top.
S_Function getCallback(int _state)
{
  return State_Functions[_state];
}

smiley
838  Using Arduino / Programming Questions / Re: Can someone help me figure out what this loop is doing? on: January 06, 2013, 02:44:55 pm
If the card did return 0, then you would get:

0x00 & 0x80 = 0 = false, which means the loop would be broken.
839  Using Arduino / Programming Questions / Re: Tick Tock Another Binary Clock on: January 06, 2013, 12:53:32 pm
Edit:

I have just noticed you are trying to have the clock automatically turn off the display, then turn it back on when the user presses a switch or something. In which case use method (1) or (2) of those i mentioned in the last post. If you make the external resistor something like 10k to 100k.
840  Using Arduino / Programming Questions / Re: Tick Tock Another Binary Clock on: January 06, 2013, 12:48:24 pm
Basically to trigger the uC to wake up, you have to cause an interrupt. To make a pin change interrupt occur, you need to simply toggle the logic state of the pin.
You can do that in a number of ways:
(1) add an external pullup resistor, then to wake up, simply pull the pin to ground with a switch.
(2) add an external pulldown resistor, then to wake up, simply connect the pin to +5v with a switch.
(3) If you went for a DS1307 based RTC, then you could connect its SQW output to Digital 0, and configure the DS1307 to output 1Hz. That way the microcontroller gets woken up once every second.

The third method would seem to me to be an ideal solution. You can put the arduino to sleep. Then when it is woken back up by the DS1307, you can read in the current time, output it to the clock display, then put the arduino back to sleep.
That way the arduino would sleep saving power for most of the time, but the clock would update once every second. You could probably accomplish reading in the time and updating the clock within a few milliseconds, meaning the arduino would sleep for about 99% of the time.
Pages: 1 ... 54 55 [56] 57 58 ... 116