Show Posts
Pages: 1 ... 16 17 [18] 19 20 ... 231
256  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.
257  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 = ""; 
258  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 ?
259  Using Arduino / Programming Questions / Re: please can someone help me? on: March 11, 2014, 02:54:12 pm
Where exactly is the library installed ?
260  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 !
261  Using Arduino / Programming Questions / Re: Volatile String Object? on: March 11, 2014, 09:36:18 am
Use a null terminated char array.
262  Using Arduino / Programming Questions / Re: Display DS18B20 High and Low Temperatures on: March 11, 2014, 09:35:02 am
You need 2 variables. Set maxTemp to zero and minTemp to 999
When you read a temperature compare it with maxTemp and minTemp.
If currentTemp is greater than maxTemp then set maxTemp to currentTemp
If currentTemp is less than minTemp then set minTemp to currentTemp
263  Using Arduino / Programming Questions / Re: please can someone help me? on: March 11, 2014, 09:30:35 am
Quote
no it is correct.
Show us the code that you are using.
264  Using Arduino / Programming Questions / Re: please can someone help me? on: March 11, 2014, 06:58:27 am
I would guess from the code that you have not posted that you have not #included the DHT library properly in line 10.
265  Using Arduino / Programming Questions / Re: Randomly LEDs fading problem on: March 11, 2014, 06:55:04 am
Try printing the value of brightness in your for loops.  Are the values what you would expect ?

Code:
  for(; brightness <= 255; brightness += fadeAmount)
This form of for loop always looks ugly to me.  Why not use the form where the loop variable is declared in the for loop ?
266  Using Arduino / Programming Questions / Re: Knob with speed limit on: March 11, 2014, 05:07:11 am
Where did you put 0.5 instead of 1 ?
267  Using Arduino / Programming Questions / Re: Help tu use strcpy to copy date and time values please on: March 11, 2014, 05:05:12 am
Try
Code:
sprintf(sdate, "%d-%02d-%02d", year(), month(), day());
268  Using Arduino / Programming Questions / Re: Need help with Char Array to String Object. on: March 11, 2014, 02:13:26 am
You say that you have problem with SoftwareSerial but don't use it in the code that you posted.  As has been pointed out, inputString is already a String so why cast it to a String ?
Code:
    receivedString = String(inputString);  // String constructor, char array to object
Judging by the comment inputString may at one time have been a C style string because the comment does not make sense at the moment.
269  Using Arduino / Programming Questions / Re: using millis to get round delays inside an if statement (xylophone servo) on: March 11, 2014, 01:47:53 am
Since he's using 7 servos, a packed byte is a good solution for chords. I gave such a solution in my first reply in the thread.

http://forum.arduino.cc/index.php?topic=224637.msg1627059#msg1627059
You did, and it is an excellent suggestion, but I am not sure if the OP is ready for it yet.
270  Using Arduino / Programming Questions / Re: Knob with speed limit on: March 10, 2014, 05:20:40 pm
Would it be OK if it moved slowly at all times, which would be fairly easy ?
Pages: 1 ... 16 17 [18] 19 20 ... 231