Show Posts
Pages: 1 2 [3] 4 5 ... 85
31  Using Arduino / Programming Questions / Re: Program can't open file on SD card on: July 13, 2014, 07:59:36 pm
I don't use the SD library because I use SDFat, however, the line
if (myFile!=false)
is different from the shorter example and could be the problem.

myFile can be evaluated as a logical expression - as in "(myfile)" - because the C++ compiler will treat any non-zero value as 'true'. So a NULL pointer (typically zero) will evaluate as false, although I would prefer to explicitly use "pointer == NULL". By comparing "myFile != false" the expression is only logically true if myFile is not equal to the value false (and I don't know what it is). Maybe changing this to the same logic as the simpler example could make a difference.
32  Using Arduino / Programming Questions / Re: LCD Keypad Shield Debounce on: July 11, 2014, 03:39:19 am
In my code libraries linked from the signature below, I have a small library to handle the analog buttons found in the LCD shield. You may be able to see how to do what you want from reading that code.

Basically you need to detect the transition from off to on rather than the on state itself.
33  Using Arduino / Programming Questions / Re: Compare array to set of numbers on: July 07, 2014, 04:54:10 pm
Where is the data array being set with the data from the device?

The only place I can see that data[] is initialised is when you print the data in the debug message. Before that it is undefined.
for ( i = 0; i < 32; i++)
      data[i] =;        
      Serial.print(" ");          
34  Using Arduino / Storage / Re: SdFat behaviour has changed - anyone know what is going on? on: July 07, 2014, 02:20:13 am
That worked. Thanks.
35  Using Arduino / LEDs and Multiplexing / Re: Push Button Array on: July 06, 2014, 04:57:35 pm
This implementation using 3 digital control lines and a 4017 may be of interest:
36  Using Arduino / Storage / SdFat behaviour has changed - anyone know what is going on? [SOLVED] on: July 06, 2014, 03:40:48 am
I had existing code using and older version of the SdFat library that worked fine and now it has stopped working after installing the newest version (20131225) . IDE version 1.0.5.

Essentially I am trying to create a file called PLAYLIST.TXT that contains the names of all the other files on the SD card. This is done using the openNext() function. PLAYLIST.TXT is created on the SD card but openNext() does not find any files.

I tried the openNext() example from the library and it worked ok, listing all the files. I modified the same example to just open the playlist file and then close it, and it also does not find the files (just prints out 'Done!' with no files listed) - listing below. Commenting out the playlist file handling in my code also results in the file names being listed.

Anyone seen this change of behaviour and is there workaround?

 * Open all files in the root dir and print their filename and modify date/time
#include <SdFat.h>

// SD chip select pin
const uint8_t chipSelect = SS;

// file system object
SdFat sd;

SdFile file;
SdFile myfile; // <<-- my mod

// define a serial output stream
ArduinoOutStream cout(Serial);
void setup() {
  while (!Serial) {} // wait for Leonardo
  // initialize the SD card at SPI_HALF_SPEED to avoid bus errors with
  // breadboards.  use SPI_FULL_SPEED for better performance.
  if (!sd.begin(chipSelect, SPI_HALF_SPEED)) sd.initErrorHalt();"PLAYLIST.TXT", O_CREAT|O_WRITE); // <<-- my mod
  // open next file in root.  The volume working directory, vwd, is root
  while (file.openNext(sd.vwd(), O_READ)) {
    cout << ' ';
    cout << endl;
  cout << "\nDone!" << endl;
  myfile.close(); // <<-- my mod
void loop() {}

37  Community / Exhibition / Gallery / Re: Midi Decoder on: July 05, 2014, 10:23:02 pm
Great project!
38  Using Arduino / Displays / Re: Display scrolling message received from serial port. on: July 04, 2014, 05:58:19 am
I have code to display from the serial port in my Parola library and Max72xx library. Links are below. You may be able to adapt the code to your own use or look at how it is done.
39  Community / Exhibition / Gallery / Re: Scrolling LED matrix display - Parola for Arduino on: July 03, 2014, 04:00:49 am
Came across these kits at that are compatible with the original hardware design.
40  Using Arduino / Displays / Re: Magelis xbt gt on: June 26, 2014, 03:00:27 pm
In principle the Magelis screens are just intelligent terminals with a serial interface. You can use them by communicating with the Arduino on the serial port. Practically, though, you will need to find documentation on the commands that you need to send through the interface to make the display work (the comms protocol). You may find something if you search the web.
41  Using Arduino / LEDs and Multiplexing / Re: How to code a scrolling led matrix on: June 17, 2014, 03:21:30 am
The Parola library (see the link in my signature) will do exactly what you are asking for + more.
42  Using Arduino / LEDs and Multiplexing / Re: Problem wiring an Uno v3, MAX7219 and an 8x8 matrix. on: June 07, 2014, 01:18:52 am
Your video is private.

The most common error is the matrix plugged in the wrong way around/upside down. Have you tried reversing that?
43  Using Arduino / Programming Questions / Re: Is There a Way to Increment and Scroll through Declared Variables? on: June 05, 2014, 09:51:34 pm
Try this:
int MyArray0[] = {1,2,3}
int MyArray1[] = {4,5,6}
int MyArray2[] = {7,8,9}

const int * (MyArray[]) = {MyArray0, MyArray1, MyArray2};

void loop
  static int x;

  const int *CurrentArray = MyArray[x]; //This is the line it doesn't like
  if (CurrentArray[1] == 5) {Serial.print("looks like it's array #2 again!");}
  x = (++x) % (sizeof(MyArray)/sizeof(MyArray[0]));

Obviously const won't work if you intend to change the value in the arrays.
44  Using Arduino / LEDs and Multiplexing / Re: 8x8 LED matrix with the MAX7219 on: June 04, 2014, 10:26:46 pm
If you download a copy of the datasheet for the MAX219 you will find the circuit that everyone uses as part of that datasheet. How to size the resistor is also part of the information supplied. Google is your friend.
45  Using Arduino / Storage / Re: Ethernet shield SD card initialization failed on: June 03, 2014, 11:59:03 pm
What I have since found is that the SPI library will use the SS defined in the libraries even though you may be using a different SS for your device. For example, if the Ethernet is on SS pin N and the SD card uses pin M, and N is the same as the SS defined in the library, when you use the SD card (pin M) the library will also set N, in the library code. This is not what you expect or want to happen.

My way around this is that if I have one device then I will just use SS, if I have more than one device then I cannot use SS (ie it is lost to me as a valid pin) and I need to use two other pins and manage it myself. This assume that the pins are not hard wired, like on a shield.

An alternative is to hack the libraries to not use the SS pin the way it does.
Pages: 1 2 [3] 4 5 ... 85