Show Posts
Pages: [1] 2 3 ... 5
1  Using Arduino / Programming Questions / Re: do constant strings use RAM? on: February 13, 2013, 11:06:31 am
Alright, in the end I decided to use this:
Code:
#define P(str) (strcpy_P(bufferA, PSTR(str)), bufferA)
where bufferA is
Code:
char bufferA[32];
and was already in use in my program as a general purpose text holder that holds data for short/very short periods of time (for example, as an alternative to returning a delay). It works, thanks!
2  Using Arduino / Programming Questions / Re: do constant strings use RAM? on: February 13, 2013, 10:15:34 am
Quote
if I try to use the F("stringHere") from the sticky in a function, I get this problem:
You need to overload your function, as the Print class has, to support the F() macro.
is F the same as PSTR? I can only find information on that function on Google.
3  Using Arduino / Programming Questions / Re: do constant strings use RAM? on: February 13, 2013, 10:01:15 am
for every single string in the program? I wonder how my program hasn't run out of memory yet, I have stings all over the place, a few arrays and the SD card library in use, and yet it still runs fine.

if I try to use the F("stringHere") from the sticky in a function, I get this problem:

"cannot convert 'const __FlashStringHelper*' to 'char*' for argument '2' to 'void myFunction..."

so what would be the most effective and easy way to get all my functions to use PROGMEM strings instead?

I'm going to do a quick memory test to see if this is really what happens.
EDIT: sadly, it's true, no matter where the string is. surely the compiler should be able to automatically optimize this or something...
4  Using Arduino / Programming Questions / do constant strings use RAM? on: February 13, 2013, 09:46:25 am
I've seen it many times before, where programs use a program memory alternative to Serial.println("text here"); in applications where more RAM is needed. why is it that the compiler makes that use RAM, though? and how exactly does it use RAM?

for example, if the program has many "quoted" (not variable) strings in it, do these all get stored in RAM is does it load a string into RAM when println is called and then unloads it afterwards, or does it keep the last string loaded until the next string related function is called? I'm guessing the first one, but I want to be a bit sure, since I've seen examples that actually copy it from PROGMEM to a global array with a set size, which would just make things worse.

thanks!
5  Products / Arduino Due / Re: TFT library compatible with Due? on: December 23, 2012, 04:57:47 am

I don't use the UTFT library, but I have a sainsmart TFT shield with a mega using an SSD1289.
I have achieved a rate of 51fps for a clear screen operation on a mega 2560, this is in a loop clearing to a random colour.
then what Library are you using? I also have a Mega and a TFT display, but it takes about a second to clear the screen! I would love to have it run faster!

also, I hope this gets noticed by the creator of the UTFT library, who wants to port it to the Due but can't because he doesn't yet own one. I guess this would make porting a whole lot easier.
6  Products / Arduino Due / what can be removed to make a "barebones" due? on: December 20, 2012, 09:21:48 am
My first thought when I looked at the Due was: "wow, that's a lot of components". Well, I actually first thought it looked similar to the Mega, but that's not the point.
The point is, I want to make my own version of this, so what can be removed? I don't need the auto-power selector (that chooses between USB and the power jack),I don't need the 5V regulator, I don't need the 2nd USB port and it's little programming chip (maybe not even the first one), I just need what the chip needs to run at full speed, and how the heck I'm going to get the code on there (I'm guessing it won't work with an ICSP programmer or an Arduino as ICSP, and you probably need the bootloader for FTDI). I'm just looking for more RAM and a lot more speed, and this seems to be the only way to go.
Besides removing everything, I still need to get my code there, of course. what kind of programmer is needed?
Also, I hear SD cards have a second way of communicating that is faster than SPI. will the DUE ever support this in a libary? And what about the Ethernet pins and library?
7  Using Arduino / Programming Questions / Re: standard SD card library does not work while "tinyFAT" does. on: December 12, 2012, 01:41:27 pm
Could it be something to do with how the SD card is formatted?
The card is FAT/FAT16, so that shouldn't be the problem.
I don't know the make, but it's a microSD card in an adapter, and it's 2GB big. I'll try another card.
8  Using Arduino / Programming Questions / standard SD card library does not work while "tinyFAT" does. on: December 12, 2012, 11:47:49 am
Hi, I'm having a rather strange problem with the SD card library. I'm trying to run the SD dumpFile example, and it outputs "Initializing SD card...Card failed, or not present" in the Serial monitor. after some hardware checking, I tried a different library, and this worked fine. However, I want to access folders and have multiple files open, create directories etc.

info:
Arduino Mega 2560

Hardware SPI (#define MEGA_SOFT_SPI is 0)
File present in root
file can be read by the tinyFAT library
Arduino IDE 1.0.1 (outdated, I know, but I have limited internet. I'll try on the latest version ASAP)
wiring done trough shield, so I can't use software SPI pins (and even if I put them on the hardware pins, it would still be slower)
the "Card failed, or not present" appears nearly instantly after the first message, a different response to what happens when the card is removed (waits a few seconds displaying the error)

I'll see if I can find anything else to try in the meantime, though I can't think of much right now.
9  Using Arduino / Programming Questions / Re: StringReplace not working, example broken. also some code help needed. on: January 07, 2012, 09:27:56 am
Code:
       String temp2=temp.replace("\n","");
In 0022, this should have worked. In 1.0, the replace() modifies the current String. It does not make a copy. So, if looks like you are using 1.0.

In which case:
Code:
temp.replace("\n","");
will replace all carriage returns with nothing, in the String in temp.

Don't forget that the String may contain \r characters, too, depending on how the String object is created.
thanks! quite confusing with the broken example though. also, the code is still not working.
I added a "function done" print before the if in the code also, to see if the code wasn't running twice.

now, I have a folder called new" in root, and inside that a folder called "newer", witch then contains some files.
this is the console output:
Code:
function done
/
NEW/0
function done
NEW/
NEWER/1
the first 3 lines were printed when I opened the "new" folder, and the other 3 lines were printed upon opening "newer". also, I have noticed that my converting code is acting weird:
Code:
String fromChar(char text[])
{
 // Serial.print("input:");
  Serial.println(text);
  String output="";
  int ammount=30;
  //Serial.println("ammount: "+ammount);
  while(ammount!=0)
  {
    byte temp=text[ammount];
    output==output+char(temp);
    ammount--;
  }
 // Serial.println("output:"+output);
  return output;
}
especially when I uncomment those input and output print statements. at least the print statements act funny and do not actually print the word amount correctly but what seems to be another section of the RAM, namely a piece of previously used string, along with some odd caracters witch I think are probably numbers. also note the print statement here is also active in the serial output above, witch is also quite weird. I really do not understand this.

again, thanks for helping me so far!
10  Using Arduino / Programming Questions / Re: 2 continuous servo differential with one joystick on: January 07, 2012, 08:56:55 am
if you want a simple method, I think you can possibly turn the joystick 45 degrees t the right or something, and making the X and Y axis control the joystick directly without any special algorithms. if your joystick is stuck like that, I guess you can use the horizontal value as a "multiplier" for the two servos as well.
11  Using Arduino / Programming Questions / StringReplace not working, example broken. also some code help needed. on: January 07, 2012, 08:19:32 am
OK, let's hope this will be better understood than most of my previous posts, because this is getting REALLY annoying. it's probably because I have asparger syndrome (social disability, forgot how it's spelt), but I do try my best to make my questions as polite and accurate as possible.

so, currently I am trying to make a file manager, and the code that does not seem to work is the thing that is meant to open the next folder. I can only go 1 folder "deep" from the root directory.
Code:
if(scan.isDirectory()){
        //Serial.println(scan.name());
        String temp=fromChar(dir)+scan.name()+'/';
        String temp2=temp.replace("\n","");
        temp.toCharArray(dir,50);
                Serial.print(temp);
                Serial.println(timesdone);
                timesdone++;
        fileManager(dir);
as you can see, I have tied many, many things and the code has become very messy. I plan on fixing that when I actually get it working. I also have commented out debugging print functions all over my code, and they all point down to this. so, can someone please tell me how to make this work?

the thing I am currently trying is the replace function, to get rid of what seems to be an unwanted return/new line in the directory. (discovered by my "timesdone" debugging code and the print functions) so what I tried to do was use the replace function to replace it with nothing, it gave me an error as everything put in that cursed if statement did, so I looked around (made a new string I tried, as you can see) and eventually I went to the example "StringReplace" and found that without even modifying the original example code, it gave me precisely the same error. the full list of errors in the example:
Code:
StringReplace.cpp: In function 'void loop()':
StringReplace:22: error: conversion from 'void' to non-scalar type 'String' requested
StringReplace:28: error: conversion from 'void' to non-scalar type 'String' requested
StringReplace:29: error: no match for 'operator=' in 'leetString = leetString.String::replace('e', '3')'
C:\Program Files\arduino-1.0\hardware\arduino\cores\arduino/WString.h:83: note: candidates are: String& String::operator=(const String&)
C:\Program Files\arduino-1.0\hardware\arduino\cores\arduino/WString.h:84: note:                 String& String::operator=(const char*)
I am using arduino 1.0 IDE, that seems like useful information. along with windows 7 32 bit, and an adruino mega, my modified version of TVOut (if that is useful for whatever reason) and the default SD library that came with  arduino 1.0 IDE (might be useful knowing it is an SD card related problem)

I hope I have provided enough helpful information, and I will be very thankful for helpful replies.
thanks.
12  Community / Website and Forum / obsolete SD library documentation. on: December 18, 2011, 04:30:28 am
apparently arduino 1.0 supports multiple files, however pages like http://arduino.cc/en/Reference/SDopen still say
Quote
Note: only one file can be open at a time.
just saying. I think to open multiple files you make more SD objects (correct? I have no idea, of course, this is a guess)  but it mentions this no-where (as far as I checked), not in examples either. I only found this in the release notes, the blog, and the "home page" of the SD library documentation.

sorry if I somehow anger admins again like I did in my previous topic, were I thought the problem of an incorrect image was easy to understand, I was wrong. I tried to make this as easy to understand as possible, to avoid more pointless arguments. thanks!
13  Community / Website and Forum / Re: incorrect image bug: arduino mega. on: October 29, 2011, 08:44:36 am

personaly, I thought clicking the image was supposed to enlarge that image. looking at the URL, it looks like it is meant to be the top view, but the picture is of the bottom.

in this fourm section I found people reporting typos, so I thought this might be where you can report bugs.

I know it is just a minor issue, but typos are also minor. I just wanted to do good.
What do you want done?
have it fixed? isn't that the reason for bug reports?
If for whatever reason it is too hard (I do not have the correct full sized image, or the camera to take one) to fix, just leave it, but know it is there. I really do not get how this is hard to understand, and I am sorry for whatever confusion I may have caused or be causing. If I am, please tell me what I am doing wrong so that I do not need to answer 20 or so questions before getting an obvious answer.
14  Community / Website and Forum / Re: incorrect image bug: arduino mega. on: October 29, 2011, 04:06:27 am
OK. here is a video of the problem:
15  Community / Website and Forum / Re: incorrect image bug: arduino mega. on: October 28, 2011, 07:10:35 am
Why does anyone ask questions?
To find out more details.
do you have the same problem?
because I am having the feeling that I am the only one having this problem, explaining people being confused about the problem, because I suspect they have tried it, and not having the same result.
Pages: [1] 2 3 ... 5