Show Posts
Pages: 1 ... 91 92 [93] 94 95 ... 233
1381  Using Arduino / Programming Questions / Re: Code Problem on: November 17, 2013, 06:05:18 pm
Well read_compass is returning a value, so try this.
Code:
void rotate_robot_right(){
  while(read_compass() < 90){
    //right
    digitalWrite(cA, HIGH); //Establishes direction of Channel A
    digitalWrite(cB, HIGH);  //Establishes backward direction of Channel B
    analogWrite(3, 245);  //Spins the motor on Channel A at max speed
    analogWrite(11, 255); //Spins the motor on Channel B at max speed

    //read_compass();
  }
}
1382  Using Arduino / Programming Questions / Re: Code Problem on: November 17, 2013, 05:51:56 pm
Why are you re-initializing headingValue again in  your read_compass function? Have you tried to debug your code with the serial monitor to see what the value of headingValue is?
1383  Using Arduino / Programming Questions / Re: New B in desperate need of guidence on: November 16, 2013, 12:09:05 am
You have EEPROM.Read( address ) in your code, yet your not doing anything with it. You could use a FOR loop in the setup() function to set the led array. Or you can store the last counter value and set the leds that way.
1384  Using Arduino / Displays / Re: Need some help with TFT display. on: November 13, 2013, 11:37:58 am
First, you need to have the adapter shield too. Second you need to download the UTFT and UTFTTouch libraries. They come with example sketches.
1385  Using Arduino / Programming Questions / Re: Receiving multidimensional array in a function on: November 09, 2013, 04:24:52 pm
You would need to change "findCommand(char cmd[]){" to look for a pointer "findCommand(char * cmd){"
Then you will also need to use the strcmp() function.

Not a great example but it should help get you going.
Code:
char command[][9] = {
  "RAPID","SHORT","SOLID","OFF"};

void setup()
{
  pinMode(13, OUTPUT);
  Serial.begin(9600);
  for(int i = 0; i < 4; i++)
  {
    getCommand(command[i]);
    Serial.println(command[i]);
    delay(2000);
  }
}

void loop() {

}


void getCommand(char * cmd)
{
  if(!strcmp(cmd,"RAPID"))
  {
    digitalWrite(13,HIGH);
    delay(100);
    digitalWrite(13,LOW);
  }

  if(!strcmp(cmd,"SHORT"))
  {
    digitalWrite(13,HIGH);   
    delay(1000);
    digitalWrite(13,LOW);
  }   

  if(!strcmp(cmd,"SOLID"))
  {
    digitalWrite(13,HIGH);
  }

  if(!strcmp(cmd,"OFF"))
  {
    digitalWrite(13,LOW);
  }

}

Added:
If you want to use Case Statements, then you need to assign or #define the "command" to a number.
So RAPID = 0, SHORT = 1, SOLID = 2, OFF = 3 and so on.
1386  Development / Other Software Development / Re: New Password Library on: November 08, 2013, 04:45:13 pm
UPDATE: (Actually finished it almost two weeks ago)
My password library is technically done, but now I'm deciding whether or not I should allow the user to choose how the data is stored. Right now both the passwords and usernames are stored in the heap, rather than the stack. However, I am thinking maybe I should allow the user to have a choice of where they store their data. The heap seems to take up more compile memory, but it also seems more efficient, and less likely to cause memory problems. Whereas the if the data was stored in the stack via 2D arrays, then it would take up less memory, but may cause problems later.

So if anyone thinks its a good idea to implement, let me know, if not then I'll keep the library as is.

Oh, I decided to not implement the LCD or Keypad libraries in my library, mainly because not everyone uses the standard LCD and Keypad libraries. But it will still work with them regardless of the library(s) used.
1387  Using Arduino / Project Guidance / Re: Which is better? 433/315 MHZ or NRF24L01 trans/receivers on: November 07, 2013, 07:08:36 pm
I'm just looking for which one has the longest possible range with minimal interference. The data being transferred is a string of 5 bytes plus seperating commas. The 433MHZ pair is ok, but I am unable to use anything that relies on timer1, so if the nRF24L01/+ can match a 100m range(or better) and still give good data quality, I'll get it. If not then I'll stay with the 433MHZ.
1388  Using Arduino / Project Guidance / Which is better? 433/315 MHZ or NRF24L01 trans/receivers on: November 07, 2013, 05:01:58 pm
I am currently using a 433MHZ pair which needs the virtual wire library to work, but I also see there is the NRF24L01 trans/receivers and as per the title, which is better? I know it all depends what I'm going to be using it for but can anyone who has used the NRF24L01 give any insight as to range and data quality? Has anyone compared them before?
What would be the better one to use?
1389  Using Arduino / Project Guidance / Re: Need help with motor control on: November 05, 2013, 05:53:35 am
Case statements.
1390  Using Arduino / Project Guidance / Re: Help with Bluetooth project feasibility on: November 04, 2013, 10:48:16 pm
Unless you are using HID bluetooth modules, or are able to switch between the slave MAC address, bluetooth I not the way to go. There is however a way you could get it to work, but not the way you want it to. I'm talking about using to two different BT modules, one for each slave, or you make a slave a transmitter for the other slave.

Standard Bluetooth modules are one to one, meaning one master controls one slave. What you could do is use both regular serial and software serial and set up two serial connections.
The other way is quite the same except the first slave will filter out the commands for itself and then using another master module, transmit the rest of the filtered data to the other slave. Basically your making a repeater, only this one will keep its own data and send the rest to the other device.

You also have Xbee modules, I'm not sure if they are one to one, or if they can transmit to multiple receivers. You can do the research. Another alternative is RF modules.
1391  Using Arduino / Programming Questions / Re: Scrolling Left and Right on a 16x2 LCD on: November 03, 2013, 10:36:08 pm
Using the shiftdisplayLeft or right function will move everything on the screen, so as PaulS suggests, you need to make your own function.

You will obviously need to input your message, and you will also need conditions (Start from here, stop here, and at what speed).
Your message will either be a char pointer / char array or String (preferably don't use). Getting the message to move to the right is easy, use a loop (non-blocking) set the cursor to show the message and increment the cursor. You will also need a blank character to trail the message, to clean up as the message moves.

Now I have a 20x4 so if my message goes off the screen, it will start to appear two lines down. I don't know what happens when your message goes off screen, so the results could be different.

Anyways, in order to shift the message, you need to know how long it is. Depending on how you store it will determine what method you need to use to get its length. Strlen() is good for char arrays and .length() is good for Strings. Now if you know how long the message is, then you can program when to crop the message and when to feed it in. Of course when you crop it, you will want to feed it in, but how would you go about feeding it in? The answer is simple, your message is stored as an array so if you know the length, then you can send out the last character shift it then send out the next one. Rinse and repeat.

The process for left shifting is just the same but backwards. You still need to know the length, but now instead of feeding the last character, your now feeding the first character. Shift, feed, shift, feed.

Nothing to it really. Just make sure you know at what point of the message you need to start to crop and feed it.
1392  Using Arduino / Project Guidance / Re: Hey, need some help on where to start programming! (Balancing Bot) on: November 03, 2013, 08:07:01 pm
He can do that, learn how to fix and write his libraries, but what I don't understand is why doesn't he download the correct Arduino library.

I looked up MPU6050 and right at the top of my search, was a link to eBay. I looked through the link and found where I could download the proper library. HERE All you need is to put the MPU6050 folder in your libraries folder, and it also comes with an example sketch to get you started.

Hope this helps.
1393  Using Arduino / Programming Questions / Re: VirtualWire Explained on: November 03, 2013, 09:06:50 am
Your right, atoi should be in there too.
int Temp1= atoi(strtok((char*)buf, ","));
1394  Using Arduino / Project Guidance / Re: Graph to Android on: November 02, 2013, 11:38:36 pm
If your using pins 0 & 1 why bother with software serial, and not just use regular serial? Software serial allows the user to send data serially and still use regular serial for debugging.
1395  Using Arduino / Programming Questions / Re: VirtualWire Explained on: November 02, 2013, 10:35:12 pm
int temp1 = strtok( (char*) buf, ",");
Try that.
Pages: 1 ... 91 92 [93] 94 95 ... 233