Show Posts
Pages: 1 [2] 3 4 ... 111
16  Using Arduino / Displays / Re: Cartesian coordinate system TFT Seeed shield v1 on: August 24, 2014, 02:41:04 pm
You need to check how the library expects the coordinates to provided. Some libraries/drivers use function(x,y) whereas others use function(y,x).

Pete
17  Using Arduino / Programming Questions / Re: Questions about Serial for continuous data project on: August 23, 2014, 11:34:14 am
You aren't reading the serial data properly.
Try this to display the CSV lines.

Code:
#define C_STX 0x02
#define C_ETX 0x03
void loop()
{
  while(Serial.available()) {
    char c = Serial.read();
    // ignore the STX
    if(c == C_STX)continue;
    // print a new line for ETX
    if(c == C_ETX) {
      Serial.println("");
      continue;
    }
    // print anything else
    Serial.print(c);
  }
}

[edit] The reason the buffer filled up on you was because you keep delaying for 50ms. During each delay of 50ms the device can send about 50 characters. You have 3 delay(50) so it's no wonder that the buffer fills up.

Pete
18  Using Arduino / Programming Questions / Re: saving changes to sketches on: August 22, 2014, 02:02:18 pm
The Arduino IDE seems to treat "example" sketches within a library as read-only but I've never had a problem overwriting one of my own sketches in the Arduino directory. I also add version numbers on the end of the filename and increment them when I get a new piece of a sketch working.

Pete
19  Using Arduino / Audio / Re: midi note-off with note-on and velocity 0 (sis-one arduino synth) on: August 22, 2014, 09:35:24 am
Try handling the note on 0 without dropping through to the next case.

Code:
    if( midi->data2 ) {
        // note on, add to "playlist"
        p_add( midi->data1, midi->data2 );
    } else {
        p_release( midi->data1 );
    }
    break;

Pete
20  Using Arduino / Programming Questions / Re: Error \404 on: August 20, 2014, 09:12:17 pm
Replace each occurrence of "\" in the strings with "\\".
The backslash has a special meaning in a C string. It is used as an "escape" character - for example, you already use the escape sequence "\n" in your strings. To get one backslash to appear when printed, you have to "escape" it with another one.

Pete
21  Using Arduino / Programming Questions / Re: Ascii code on: August 20, 2014, 07:27:57 pm
The character '0' is 48 decimal. If you subtract '0' from it you get zero. The ascii code for '.' is 46 decimal so subtracting '0' from it gives you -2.
You aren't displaying the received characters properly. You don't have to convert the characters to binary.
Instead of Serial.print(c-'0') just use Serial.print(c);

Pete
22  Using Arduino / General Electronics / Re: GPS: can you lock on to same Satellite? on: August 19, 2014, 06:37:23 pm
Why would you want to do that?

Pete
23  Using Arduino / Programming Questions / Re: Altering an RTC library. on: August 19, 2014, 04:34:02 pm
The MCP795X is an SPI device whereas the DS1307 is I2C. If I were tackling this, I think I'd start by looking for a library for the DS3234 RTC which is also SPI. I expect it would be easier to change only the registers rather than also have to rewrite the entire protocol as well.

Pete
24  Using Arduino / Project Guidance / Re: Use FHT library with Gemma on: August 19, 2014, 01:58:56 pm
One of the specs for Gemma is
"ATtiny85 on-board, 8K of flash, 512 byte of SRAM, 512 bytes of EEPROM"
so I'm going to go with "no".

Pete
P.S. The Google images for "Gemma" are ummmm interesting.
25  Using Arduino / Audio / Re: How can I ignore all messages that arent notes? (i.e.midi clock) on: August 19, 2014, 01:51:02 pm
You can't read a midi stream 3 bytes at a time and assume that all messages have that format - they don't.
A midi message always begins with a byte whose high order bit is set and all other bytes in the same message do not have this bit set. This makes it easy to sync with a midi stream.
Therefore your code should look for a byte with the high order bit set. The content of that byte will tell you how many more bytes to expect in the message.

Pete
26  Using Arduino / Programming Questions / Re: Dumb novice question -- How does one stop a sketch from continuing to run? on: August 19, 2014, 12:57:56 pm
Code:
while(1);

Pete
27  Using Arduino / Programming Questions / Re: String.length() always return 0 on: August 19, 2014, 11:51:36 am
This code:
Code:
void setup(void)
{
  Serial.begin(9600);
  while(!Serial);
  delay(2000);
 
  String txtMsg = "TEST STRING ";             // a string for incoming text
  int lastStringLength = txtMsg.length();     // previous length of the String
 
  if(lastStringLength)
  {
    Serial.print("String length is ");
    Serial.println(lastStringLength);
  } else {
    Serial.println (" Empty string ");
  }
}

void loop(void)
{
}
prints
Quote
String length is 12

You're doing something wrong which you haven't shown us.
Pete
28  Using Arduino / Programming Questions / Re: Calculating Celsius using Datalogger on: August 18, 2014, 10:40:47 pm
It is right. I checked the math and it works out.

Pete
29  Using Arduino / Programming Questions / Re: Memory problems, sd card stored arrays ... on: August 18, 2014, 04:28:55 pm
You don't need to use new/delete. It will create more problems than it is worth.
Declare a static array and when you are done with it, just overwrite it with the next set of values.

Pete
30  Using Arduino / Programming Questions / Re: Memory problems, sd card stored arrays ... on: August 18, 2014, 01:50:00 pm
How big an array are you planning to read?
The SD card library uses a 512 byte buffer to be able to read the card so the 2kB ram is down to 1.5kB before you've read anything from the card. You might have to rethink the whole project.

Pete
Pages: 1 [2] 3 4 ... 111