Show Posts
Pages: 1 ... 17 18 [19] 20 21 ... 232
271  Using Arduino / Programming Questions / Re: Debugging Arrays and printing to serial on: March 12, 2014, 03:18:15 pm
Quote
My big question is: is there some way to "test" the pins in the array and tell if someting is wrong, and then print it to Serial.Println()?
What test do you want to apply ?  You could write something that set each of the pins HIGH in turn and read the output using another pin I suppose.  If a particular pin does not produce LOW and HIGH outputs at the appropriate time then report it.  But how do you know that the pin used to read the output is working ?

More usefully perhaps, flash each LED in turn at startup and watch them.  Simple to do and use.  No need to even have a PC connected.
272  Using Arduino / Programming Questions / Re: Generate random numbers WITHOUT using the analog pin 0 on: March 12, 2014, 03:09:15 pm
Nothing you have said would preclude the use of the method that I suggested.  You are presumably going to run the program more than once so, power up the Arduino and have a button labelled START.  It will be pressed at a different time after the Arduino is powered up each time that happens, hence the seed will be different each time, or largely so.
273  Using Arduino / Programming Questions / Re: I might have figured out my problem with delays!!! (maybe not) on: March 12, 2014, 02:55:08 pm
Quote
Seems like unsigned longs are related to if and else statements.
Wrong, I am afraid.

unsigned longs are just a type of variable.  They allow longer (larger) integers to be stored than an int and being unsigned are always positive.  Look at the data type pages on here http://arduino.cc/en/Reference/HomePage#.UyC9kD9_s1I for an explanation of the range of values that each data type can hold.
274  Using Arduino / Programming Questions / Re: Need Help With Reading In RC Input And Using As An Interrupt on: March 12, 2014, 02:31:41 pm
Quote
Atm I would rather have it be killed easily.
Don't make it easy to do by mistake.  Quads don't glide too well !

You will not be able to use an interrupt to interpret an RC input because it is a pwm signal which constantly alternates between HIGH and LOW, so catching it with an interrupt will be challenging.
275  Using Arduino / Programming Questions / Re: I might have figured out my problem with delays!!! (maybe not) on: March 12, 2014, 12:49:12 pm
If it worked then your program would leave the Relay3 pin HIGH as it is never taken LOW.  Is that what you want ?

As to whether it will work.  Did you read what PaulS said about literal values being interpreted as ints and his suggestion as to how make the be regarded as unsigned longs ?

Can I suggest that you write the millis() value to the serial monitor when the delays in your program finish.  That way, even if you are asleep you will know that they happened.
276  Using Arduino / Programming Questions / Re: Generate random numbers WITHOUT using the analog pin 0 on: March 12, 2014, 12:32:04 pm
Can you have the user press a button to start the program ?  If so, then use the millis() or micros() value at the time of the button press to seed randomSeed().  It will still not be entirely random but should differ for most runs of the program.
277  Using Arduino / Programming Questions / Re: please can someone help me? on: March 12, 2014, 12:23:57 pm
I have followed the guide but it may not work anyway?
If you have followed the guide then this will not be true
Quote
Library is located in the arduino folder run arduino from a folder on the desktop.

Which is it ?  Have you followed the guide or are the library files in the arduino folder on the desktop ?
What is the exact path to the folder in which you have installed the DHT library ?
278  Using Arduino / Programming Questions / Re: lcd blink particular index variable on: March 12, 2014, 12:19:23 pm
AMPS - can you please explain what the Blink_LCD() function is supposed to do ?

Why all the (any ?) gotos ?  The switch/case should take care of itself and only execute the case where the switch variable is true.  The breaks prevent other cases being executed.
279  Using Arduino / Programming Questions / Re: Default compiler in Arduino on: March 12, 2014, 02:35:27 am
Quote
1. How to change default compiler for Arduino to avr-gcc ????
What compiler does it use as a default at present I wonder.
280  Using Arduino / Programming Questions / Re: Subtracting New TIme interval on: March 12, 2014, 02:21:42 am
I wanted to subtract two time interval. here one time interval is 5hour 30 minute and other is current time.the code is written as follow.
Error report i am getting while run on arduino platform . but this code working fine run on python.
Quote
error: invalid operands of types 'double' and 'int' to binary 'operator%'
Code:
main()
{
int Time1;
int Time2;
int hour=10;
int minute=5;
int second=13;
int h; int m;
double  Ntime;
Time1=(3600*5)+(60*30);
Time2=(3600*hour)+(60*minute)+second;
Ntime=Time2-Time1;
Ntime=((Ntime%60)/100+(Ntime/60));
h=(int)(Ntime);
m=((Ntime-h)*100);
printf("hour after subtraction is : %d hour %d min",h,m)

}
Modulo (%) only works on integers (int or long) not floating point values.  So
Code:
Ntime%60
is invalid because Ntime is a double (why ?)

The code does not compile because of a missing semi-colon nor does it produce any output because it uses printf().  Is this really an Arduino question ?
281  Using Arduino / Programming Questions / Re: Need Help With Reading In RC Input And Using As An Interrupt on: March 12, 2014, 02:06:24 am
Code:
byte receiverPin = 7;
unsigned long duration;

void setup()
{
  Serial.begin(115200);
  pinMode(receiverPin, INPUT);
}

void loop()
{
  duration = pulseIn(receiverPin, HIGH);
  Serial.println(duration);
}
Connect one of the receiver outputs to pin 7 and GND to GND.  The serial output will vary with the Tx stick or switch position.  Now you can take action, such as shutting down the motors, based on the value.

Note, however, that using the value from only one channel as a "kill" could be dangerous because it would be easy to trigger it by mistake.  It would be better to read the value of two inputs and only if both of them were in the correct position, perhaps low throttle and full left rudder, disarm the system.
282  Using Arduino / Programming Questions / Re: Need help with Char Array to String Object. on: March 11, 2014, 05:24:56 pm
String libraries in Arduino need a String object not an Array of chars, hence the String = String(ArrayOfChars).
But inputString is not an array of chars, it is a String.

From your code
Code:
String inputString = ""; 
283  Using Arduino / Programming Questions / Re: Need Help With Reading In RC Input And Using As An Interrupt on: March 11, 2014, 02:59:24 pm
You can use pulseIn to read a channel from an RC receiver.  Are you sure that you need to use an interrupt ?
284  Using Arduino / Programming Questions / Re: please can someone help me? on: March 11, 2014, 02:54:12 pm
Where exactly is the library installed ?
285  Using Arduino / Programming Questions / Re: please can someone help me? on: March 11, 2014, 02:01:52 pm
Quote
but wonder what is wrong when I get this error code?
The program cannot find the library file.  Either you have not used #include properly, the library was not installed properly or you did not stop/restart the IDE after installing the library.

Is the DHT library installed ?
If so, where ?

POST YOUR CODE !
Pages: 1 ... 17 18 [19] 20 21 ... 232