Show Posts
Pages: 1 ... 71 72 [73] 74 75 ... 251
1081  Using Arduino / Project Guidance / Re: 2.4" TouchScreen Shield in Arduinouno on: February 27, 2014, 11:43:41 am
What library does it use and see what available functions it has already. I'm sure it has some example sketches that came with it, like a demo of its features.
1082  Using Arduino / Programming Questions / Re: Help with Science Fair Project Code. on: February 27, 2014, 03:11:26 am
You are aware that the only time you get measurement is when your not sending anything over Bluetooth. Make the "ping" section a function that you can call when you need it, instead of how you have it now.

Also if your currently using the serial monitor to test the code, then why are you checking if the Bluetooth is sending something when your reading from the serial monitor?
Quote
if (BTSerial.available() > 0) // Check and see if there is serial input
{ Direction = Serial.read(); // If there is input set the Direction variable to that value.
{ <= unneeded bracket, get rid of it and its closing counterpart.
1083  Using Arduino / Project Guidance / Re: Control DC motors using Arduino on: February 27, 2014, 01:03:27 am
Quote
I need help to control the DC speed motors speeds

Easy enough, the analogWrite function is what you need to use. What are you going to use as a motor controller? Make sure you take into consideration the power to weight ratio. The sum of the combined weights must be less than what the motors can provide, otherwise it will not get off the ground.

Quote
make my quadcopter hover at a certain position above the earth.
This will require a GPS module.
1084  Using Arduino / Programming Questions / Re: Problem debouncing multiple buttons on: February 27, 2014, 12:57:23 am
You have to use arrays to hold everything, button pins, last states and previous times. Have a counter based on the number of buttons you have ie 2. Use an IF statement to increment the counter if it is less then the number of buttons, and reset counter to 0 if it goes over the number of buttons.

You can use the same debounce sketch you have for the one button, but now make everything arrays.
1085  Using Arduino / Project Guidance / Re: Robot arm problems with joysticks and base on: February 26, 2014, 10:11:02 pm
I understand the sweep example very well, but the way your doing it is incorrect. You want to move one way and stop where you want it, then if you go the other way it move accordingly. What you need to do is record the last position then take the difference of new position and the previous position.

Let me ask this, does your joystick or pot spring back to a fixed position or hold it's position when let go?
1086  Using Arduino / Project Guidance / Re: Project to make my dog stop peeing on my bathroom on: February 26, 2014, 09:29:34 pm
You could maybe attach a small RFID tag on his collar, and if s/he enters the bathroom it triggers a loud noise to play or something. Just like what is used in stores to prevent shoplifters.

Im not sure where you would be able to get the components for something like that, I know normal RFID tags need to be within a certain range for them to be read.

Look into it.
1087  Using Arduino / Project Guidance / Re: Robot arm problems with joysticks and base on: February 26, 2014, 09:18:44 pm
You dont need a for loop to do that, just tell it where to go and unless the value changes, the servo will stay the same.
1088  Using Arduino / Project Guidance / Re: Robot arm problems with joysticks and base on: February 26, 2014, 07:41:21 pm
It should be
Quote
for (clawpos = 0; clawpos < 450; clawpos += 1);
for (clawpos = 0; clawpos > 750; clawpos -= 1);
Because you never increment or decrement onex in the for loops.

But upon closer inspection, onex is a reading from the analog input A0, so why are you using FOR loops at all and not mapping the value?

clawpos = map( onex, 0, 1023, 0, 180);
1089  Using Arduino / Programming Questions / Re: While loop exit condition on: February 26, 2014, 04:23:58 am
Check your brackets, your not reading the button in the while loop.
1090  Using Arduino / Programming Questions / Re: While loop exit condition on: February 26, 2014, 03:58:39 am
You need to read the button again, this time in the while loop.
1091  Using Arduino / Programming Questions / Re: Need help with PWM Motor on: February 26, 2014, 01:38:48 am
Actually, if the motor is to be on forever when the button is pressed, then all you need is.

if(digitalRead(2) )  analogWrite(motor pin, 200); //no brackets needed for one line of code.
The motor will now always be on until commanded otherwise.
1092  Using Arduino / Programming Questions / Re: Need help with PWM Motor on: February 26, 2014, 01:33:36 am
You need to add boolean latch = false; at the top with the rest of your pins. Another thing, if the motor is to stay on forever when the button is pressed, then why have an else statement that makes it turn off?

To answer your problem, you need another if statement that looks to see if latch is true, then if it is, motor goes on.
1093  Using Arduino / Programming Questions / Re: Need help with PWM Motor on: February 26, 2014, 01:16:54 am
If button 2 is pressed and nothing else changes "latch", then yes, latch will always be true.
Quote
if(digitalRead(2) == HIGH)
{
  latch = true;
}
1094  Using Arduino / Programming Questions / Re: Need help with PWM Motor on: February 26, 2014, 01:01:27 am
Yes, but will you be using that same button to then turn it off too?

To use the same button to turn it on/off, you need a latch. 

Example pseudo code:
Code:
boolean latch = LOW; // declaired at top of code

// inside the loop() or a function
if(digitalRead(2) == HIGH)
// you will need another variable to block this IF statement if the button is held down ie. Prev_state.
// Also debouncing may be needed, but you have an example code under Examples with the Arduino software
{
  latch = ! latch;
}

To do it with two different buttons.
Code:
if(digitalRead(2) == HIGH)
{
  latch = true; // digital/analogWrite( motor pin, set speed)
}
else if(digitalRead(3) == HIGH)
{
  latch = false; // digital/analogWrite( motor pin, 0 or LOW)
}
1095  Using Arduino / Programming Questions / Re: Need help with PWM Motor on: February 26, 2014, 12:18:10 am
Ok, then get rid of all the unneeded things like
Quote
int speed = Serial.parseInt();
    if (speed >= 0 && speed <= 255)
    {
and just have analogWrite(motorPin, /* Pick a number between 0 - 255 */);
Pages: 1 ... 71 72 [73] 74 75 ... 251