Show Posts
Pages: 1 ... 61 62 [63] 64 65 ... 243
931  Using Arduino / Programming Questions / Re: Help with Science Fair Project Code. on: February 28, 2014, 07:16:38 pm
Are those values being sent from the app or serial monitor?
932  Using Arduino / Programming Questions / Re: Help with Science Fair Project Code. on: February 28, 2014, 06:40:20 pm
Quote
I get back values such as 49 and 50.
ok good, you get back what you send in, just in decimal.

So my next question is, what is it not doing, that it should be doing?
933  Using Arduino / Programming Questions / Re: Bit stuck on bit manipulations ? on: February 28, 2014, 06:36:34 pm
Oh, then in that case its simple, shift 5BC0 to the right 5 bits.
Code:
int Pressure = (B_1 << 8) | B_2; // this is fine
int Temp = (B_3 << 8) | B_4; //this produces 5BC0
Temp >>=5; // 5BC0 >> 5 = 02DE
934  Using Arduino / Programming Questions / Re: Bit stuck on bit manipulations ? on: February 28, 2014, 05:41:53 pm
Do you mean like this?
Code:
void setup()
{
Serial.begin(115200);

byte B_1 = 0xA0 & 0x3F; // already combined
byte B_2 = 0x04;
byte B_3 = 0x5B;
byte B_4 = 0xD4 & 0xE0; // already combined

int Pressure = (B_1 << 8) | B_2;
int Temp = (B_3 << 8) | B_4;

Serial.println(Pressure,HEX);
Serial.println(Temp,HEX);
}

void loop()
{
 
}

Output in HEX
Quote
2004
5BC0
935  Using Arduino / Project Guidance / Re: Robot arm problems with joysticks and base on: February 28, 2014, 05:17:16 pm
Well then it can be done like this.

See what the value is when it's untouched (Center value), then set a dead zone based on that value. It can be +-3 ( or whichever works for you) of the center value.

Now when the joystick reading is greater then the center value, get the maximum value read. So as you move the joystick forward, the maximum value should increase and stay there even if you return to center. Once you get the maximum value, store it. You can reset it once you pass the center value and start to go below it. At this point you can get the minimum value and start to calculate the difference of the two. The difference can be what moves the servo.
936  Using Arduino / Programming Questions / Re: Bit stuck on bit manipulations ? on: February 28, 2014, 04:58:54 pm
Your correct, in me being wrong, 0x3F = B00111111; I fixed them.
937  Using Arduino / Programming Questions / Re: Bit stuck on bit manipulations ? on: February 28, 2014, 04:26:51 pm
Yes, your right. It should have been. byte B1 = B00101100 & 0x3F; // 0x3F = B00111111;
Why is Octal even used anymore, it should just be binary, decimal and hex.
938  Using Arduino / Programming Questions / Re: Bit stuck on bit manipulations ? on: February 28, 2014, 03:48:12 pm
Ok so get a reading of the values before and after you change them, then  compare them to what you should be getting.

You might need to typecase the read value as ints then add them.
939  Using Arduino / Programming Questions / Re: Bit stuck on bit manipulations ? on: February 28, 2014, 03:16:58 pm
Quote
Byte 1: 00101100 //use last 6 bits
Byte 2: 11001101  //use all 8 bits
Byte 3: 01011100 //use all 8 bits
Byte 4: 11100000 //use first 3 bits

byte B1 = 00101100 & 0x3F; // 0x3F = 00111111;
byte B4 = 11100000 & 0xE0; // 0xE0 = 11100000;
Bytes B2 and B3 can stay the same.
940  Using Arduino / Programming Questions / Re: Help with Science Fair Project Code. on: February 28, 2014, 01:41:20 am
I just tested the code you provided above, and it works like the way it is written. I didn't change anything,
Try this, add Serial.println(Direction); right after you read it, I want to know if you get back what you sent in.
941  Using Arduino / Programming Questions / Re: Help with Science Fair Project Code. on: February 28, 2014, 12:57:33 am
Direction is a byte, change it to char and see if it makes a difference. I see you have delays in there, it's ok for testing but the final code should not have delays in it.
942  Using Arduino / Programming Questions / Re: Problem debouncing multiple buttons on: February 27, 2014, 11:43:28 pm
Post your full code in code tags.
943  Using Arduino / Programming Questions / Re: Help with Science Fair Project Code. on: February 27, 2014, 10:19:26 pm
So wait, when the robot does not receive a signal from the app, it is supposed to rely on the sensor? If that is the case, then you had it correct.

But this still doesn't seem correct. With this part here, you won't be able to get any data unless the bluetooth app is actually sending something. However, like I said, if you want to test it with the serial monitor then you need change BTSerial to just Serial.
 
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.
944  Using Arduino / Project Guidance / Re: Robot arm problems with joysticks and base on: February 27, 2014, 10:12:28 pm
It springs back, ok then you will need a button to hold the position of where you want the servo to stay.
You can use the joy stick like normal, and you can press and hold a button to move the servo then release where you want it. However with this method you need to tell the code to disregard the joystick reading when you are not moving it, otherwise it will move the servo when you don't want it to.
945  Using Arduino / Programming Questions / Re: Problem debouncing multiple buttons on: February 27, 2014, 10:04:35 pm
Can you please fix you post and put your code inside code tags. Its the # symbol above the smiley faces.
Pages: 1 ... 61 62 [63] 64 65 ... 243