Loading...
  Show Posts
Pages: [1] 2
1  Development / Other Software Development / Failed in importing Ethernet lib with Jantje's plugin for eclipse on: December 05, 2012, 04:06:23 am
Hi, there,

I am trying to import the 'built-in' library Ethernet into my project under Eclipse, but it said the w5100.h was not found, after deleting it from the list in project's Includes tree node in Eclipse, it would throw out an error saying 'fatal error: pins_arduino.h:could not find the file' or, sometimes, 'fatal error: arduino.h could not find the file".  It seemed it could not find the w5100.h located under the subfolder Utility.

Any suggestions would be appreciated!

Ardypro
2  Development / Other Software Development / Re: How to open the project made with Jantje's plugin under eclipse on: October 21, 2012, 09:42:44 am
thank you, Jantje, for your kind reponse and your useful plugin.
3  Development / Other Software Development / Re: How to open the project made with Jantje's plugin under eclipse on: October 21, 2012, 01:03:07 am
For example, if a project was created with CodeBlocks, the ext name for the project file would be cbp, double clicked it would fire CB to open it. I did not find a project file in the files created with Eclipse, however.
4  Using Arduino / Programming Questions / Re: How to use a Timer on: October 20, 2012, 08:33:36 pm
I think you need use
Code:
if (duration1 >= 2000)
{
}
, so there might be a chance for the arduino executes codes in the block. Arduino or any other mcu could hardly execute precisely that consume just 2000 microseconds, the actual value might be 1999, 2001 or any other value around 2000.
5  Development / Other Software Development / How to open the project made with Jantje's plugin under eclipse on: October 20, 2012, 04:08:10 pm
Hi, all,

Hoping this is the correct place I ask the question.

I installed the Eclipse Indigo with Jantje's plugin for Arduino under Windows 7 and Ubuntu 12.04. Under the same OS, I knew how to creat and reopen the project created with this plugin, but if I switched to another OS, I had no idea how to open the project since the 'open project' menu item was disabled. Any sugguestions would be highly appreciated!
6  Using Arduino / Programming Questions / Re: Help with converting integer to unsigned char* on: August 01, 2012, 06:07:31 am
And why the two buffers?

One to host char type buffer and the other to host unsigned char type ubuffer. The following code snippets is quoted from internet and works for me.

Code:
void displayInt(int r, int c, int value)  //
{
  int number= value; // the interger should be in the range from -32768 ~ 32767
  char buf [16];
  itoa(number,buf,10); //transform integer into string
  unsigned char temp[16];

  for (int i=0;i<=15;i++)
  {
    if(buf[i]!='0'&&buf[i]!='1'&&buf[i]!='2'&&buf[i]!='3'&&buf[i]!='4'&&buf[i]!='5'&&buf[i]!='6'&&buf[i]!='7'&&buf[i]!='8'&&buf[i]!='9'&&buf[i]!='-')
    {
      temp[i]=' ';
    }   // put space into those where no  values are assigned initially
    else
    {
      temp[i]=buf[i];
    }
  }
  LCDA.DisplayString(r,c,temp,16);//display the counter on the screen  
  yanshi();
}
7  Using Arduino / Programming Questions / Re: Help with converting integer to unsigned char* on: August 01, 2012, 05:48:55 am
Never, ever return a pointer to an automatic variable.
"ubuffer" is allocated on the stack, so becomes free for anyone else to stomp on as soon as your function returns.

should this be replaced as Int2uCharArr(int value, unsigned char &output) ?
8  Using Arduino / Programming Questions / Re: Help with converting integer to unsigned char* on: August 01, 2012, 05:45:38 am
Code:
  char buffer[5]={    '0'            };
  unsigned char ubuffer[5]={    '0'            };
So, the other 4 elements of each array are undefined. Why is that?

Thanks, Paul,  it should be "00000" instead.
9  Using Arduino / Programming Questions / Re: Help with converting integer to unsigned char* on: August 01, 2012, 05:26:13 am
I made a demo function to convert the integer to unsigned char*, the result in Serial monitor seemed correct, but when to be displayed with LCD, it did not work as expected.


Code:
unsigned char* int2uCharArray(int value)
{
  char buffer[5]={    '0'            };
  unsigned char ubuffer[5]={    '0'            };
  itoa(value,buffer,10);
  for (int i=0;i<5;i++)
    ubuffer[i]=buffer[i];

  Serial.println("int2chararray");
  for (int i=0;i<5;i++)
    Serial.println(ubuffer[i]);
  Serial.println("END TEST");

  return ubuffer;
}
10  Using Arduino / Programming Questions / Re: Help with converting integer to unsigned char* on: August 01, 2012, 05:09:48 am
For integer:

Code:
char temp[20];
int myNumber = 3822;

sprintf(temp,"%d",myNumber);
LCD.whateverPrintFunctionItIs(temp);

...

Thank you, but this code does not work, since the function in the library requires the temp[20] should be unsigned char*.
11  Using Arduino / Programming Questions / Re: Help with converting integer to unsigned char* on: August 01, 2012, 05:00:05 am
That's not going to work if "myVarName" is a float!

OP, most display libraries have methods for displaying common datatypes - which one are you using?
Can you post your code?

The library LCD12864RSPI is supposed to be programmed by dfrobot, the function to display string is declared as void LCD12864RSPI::DisplayString(int X,int Y,uchar *ptr,int dat), the last param is the length of the *ptr. There is no overrided method to display string with string as its parameter. :-(
12  Using Arduino / Programming Questions / Help with converting integer to unsigned char* on: August 01, 2012, 03:38:29 am
The library for 12864 LCD I am using requires the message to be displayed should be unsigned char* type, I am new to C++, could anyone tell me how to convert the integer or float to unsigned char*?

Thanks a lot.

Ardypro
13  Using Arduino / Programming Questions / Re: Strange print result on: January 18, 2012, 11:40:24 pm

You need to statically size the array called value, like so:
Code:
char value[10];

I just changed the declaration as following:
Code:
char * value;
value = " ";

other parts remained unchanged, the result seemed correct. In this case, is value still read only?
14  Using Arduino / Installation & Troubleshooting / Serial port 'COM3' already in use on: January 18, 2012, 12:35:08 pm
Hi, all,

My mega1280 board ran into 'Serial port 'COM3'  already in use' error recently, it would be out of work even if I close the IDE and serial monitor, I checked the computer and found no applications were occupying the serial port. It might be OK after powering off and restarting the board again.

I am wondering what's wrong with it.

BR,

Ardypro
15  Using Arduino / Programming Questions / Strange print result on: January 18, 2012, 12:24:50 pm
Hi, all,

I am a newbie on C++ and arduino, when I try to get the entry of integer from serial monitor, it runs into some problem. Some println are added into the codes to track the how the codes run.

Code:
boolean loopflag=false;
String brandName="";
byte Counts=0;
String buttonName="";

byte getNumber()
{
  char * value="";
  String s="";
  s=getChars();

  Serial.println("***DEBUG GETNUMBER s-->");
  Serial.println(s);

  ///***************************************
  for (int i=0; i< s.length(); i++)
  {
    value[i]=s[i];
    //value[i+1]='\0';

    Serial.println("value[i]");
    Serial.println(value);

  }
  ////****************************************
 
  Serial.println("***DEBUG GETNUMBER value-->");
  Serial.println(value);
  Serial.println("***END DEBUG***");
  Serial.println("");

  return atoi(value);

}

String getChars(void)
{
  char rcv=' ';
  String str;
  while (rcv!='\n')
  {
    if (rcv!=' ')
      str += rcv;
    if (Serial.available()>0)
      rcv=Serial.read();
    else
      rcv=' ';
  }
  return str;
}

void setup()
{
  Serial.begin(9600);
  Serial.print("Please enter the brand name of your remote:");

  brandName=getChars();
  Serial.println(brandName);

  Serial.println("Please enter how many records ");
  Serial.println("would be recorded per button:");
  Counts = getNumber();

  Serial.println("");
  Serial.println("Counts=");
  Serial.println(Counts,DEC);

  Serial.println(" ***END SETUP*** ");
}

void loop()
{
  if (!loopflag)
  {
    Serial.println("loop procedure");
    loopflag=true;
  }
}

The serial monitor would display like these:

Please enter the brand name of your remote:SONY
Please enter how many records
would be recorded per button:
***DEBUG GETNUMBER s-->
248
value
2loop procedure
value
24oop procedure
value
248op procedure
***DEBUG GETNUMBER value-->
248op procedure
***END DEBUG***
248op procedure
248op procedure
Counts=
248
 ***END SETUP***
48op procedure

When I would like to display the value, it seems print out the its value and, strangely, the part of the string in loop() procedure. And the code calls '  Serial.println("");' once in line 32 in setup(), but there are two lines are printed out as '248op procedure'.

Would you please tell me what the errors I have made in the above codes.

BR,

Ardypro
Pages: [1] 2