Loading...
  Show Posts
Pages: 1 ... 33 34 [35] 36 37 ... 48
511  Using Arduino / Programming Questions / Re: Help with converting integer to unsigned char* on: August 01, 2012, 05:33:25 am
If this is the function you are using you cannot just return ubuffer and use it as it is only valid in the function. Outside of the function the value is not defined and will probably be corrupted. You need to add the word static in front of the variable declaration for this to work.
512  Using Arduino / Programming Questions / Re: Help with converting integer to unsigned char* on: August 01, 2012, 03:52:14 am
I really also think that OP needs to clarify if he needs to convert the numbers to a string or if the value is just passed in what is effectively a byte buffer.
513  Using Arduino / Programming Questions / Re: Help with converting integer to unsigned char* on: August 01, 2012, 03:44:57 am
The easiest way is to cast the value when you call the function, provided you know the library is simply expecting a buffer with the value and not actually chars. Cast by putting the desired type in front of the variable name.

Code:
myFunction((char *) myVarName)
514  Using Arduino / Programming Questions / Re: const + struct + array on: July 29, 2012, 05:38:42 am
I think the typedef is the issue. You need to declare it in a header file for it to work. Seemed to fix a similar issue I had in the past.
515  Using Arduino / Programming Questions / Re: reseting millis() on: July 28, 2012, 10:35:08 pm
Millis can't be reset. What you need to do is remember when your time period started by storing the value of millis at the time and then working out time elapsed by subtracting current value from the stored value.  This is a pretty common technique with timing stuff on computers.
516  Using Arduino / Programming Questions / Re: Push Button Counter on: July 28, 2012, 05:13:31 pm
You are sending many message because countbutton is 1. Every time through the loop you will be doing this.

Have you declared lastStatoButton for a reason? you do not appear to be using it and it may be the way to resolve your problem if you detect the change of state rather than the state itself.
517  Using Arduino / Programming Questions / Re: How to send an integer value through serial port? (Arduino to Pc) on: July 28, 2012, 06:03:42 am
Serial.write will only send one byte, so max is 255.

Use serial.print to send the ASCII string of your number.
518  Using Arduino / Programming Questions / Re: How to send an integer value through serial port? (Arduino to Pc) on: July 28, 2012, 03:42:04 am
Please post your code.
519  Using Arduino / Programming Questions / Re: arduino counting LED light on: July 27, 2012, 08:08:00 pm
Code:
int ledpin = 12;
int counter = 0;

void setup()
{
  //set outpups
  pinMode(ledpin, OUTPUT);
 
  Serial.begin(9600);
}

void loop()
{
 Serial.print(digitalRead(ledpin));
 
 delay(100);
 
  digitalWrite(ledpin, HIGH);
  counter = counter + 1;  // or counter++ does the same thing
  Serial.print(counter);

  delay(1000);
 
  digitalWrite(ledpin, LOW);
 
  delay(1000);
}
520  Using Arduino / Programming Questions / Re: arduino counting LED light on: July 27, 2012, 07:57:26 pm
Set up a counter and increment it every time you set the LED high. Then print the count just like you are printing the LED status in your sketch.
521  Using Arduino / Programming Questions / Re: Problem with performing fractions with Arduino UNO R3 on: July 25, 2012, 01:37:34 am
You need to post all the code because you probably have problems with your variable definitions. For a start you are casting to long and float when you are printing and calculating, which may give you diferent results.
522  Using Arduino / Programming Questions / Re: problem controlling Servos through C# on: July 23, 2012, 11:06:49 pm
Look at this thread "Simple-yet-powerfull - Serial Command input with numbers" as somewhere to start

http://arduino.cc/forum/index.php/topic,115174.0.html

523  Using Arduino / Programming Questions / Re: Arduino calculating math incorrectly? on: July 23, 2012, 07:15:10 pm
Quote
for the Arduino

That is not the case for other implementations of C/C++. The bigger the precision the more it takes to calculate, especially as there is no floating point hardware support. How many decimal places to you need?
524  Using Arduino / General Electronics / Re: Looking for some header innerconnect recommendations on: July 23, 2012, 07:06:43 pm
Here's another option. These ribbon cables can be split to suit the number of cores you need. Many sources other than eBay for these.

http://www.ebay.com.au/itm/Rainbow-Color-40-Way-Cable-30cm-Flat-Arduino-Jumper-Cable-Home-Appliance-/180854947595?pt=AU_MobilePhoneAccessories&hash=item2a1bcb7f0b
525  Using Arduino / Programming Questions / Re: Specify "Pin"? on: July 23, 2012, 04:50:49 pm
Yes it all works. The name is irrelevant as the compiler and linker will simply translate it all to a memory address when it does it's job.
Pages: 1 ... 33 34 [35] 36 37 ... 48