Show Posts
Pages: 1 ... 70 71 [72] 73 74 ... 229
1066  Using Arduino / Project Guidance / Re: combined lanc+PS/2 controller possible? on: January 08, 2014, 01:59:17 am
It should be as simple as combining the setup functions, loop functions and just drop-in everything else. Make sure they use different pins, or have it so that the same pins are called to do the same thing I.E open/close shutter, take photo, things like that.
1067  Using Arduino / Programming Questions / Re: multidimensional boolean array ?? on: January 08, 2014, 01:08:20 am
Not sure you fully understand arrays or maybe you just made "small" have different data on purpose, but you can use a FOR loop(s).

If you know how many elements you have per group (in this case you have 3) you can use the module operator (%) to change the group when you get to the last element of the group. But still, you should either have two different arrays, maybe  small and Small.
1068  Using Arduino / Project Guidance / Re: Learning about Arduino & Electronics on: January 08, 2014, 12:24:01 am
If you want to learn electronics and how everything works together, go by a small toy (anything) and take it apart. You know what most componets are, and I'm sure you know how to read a schematic, right? If you do, then you should study the toy's circuit board, write down a schematic of what you see (part numbers, resistor bands, everything). Once you are comfortable with your schematic, take apart the circuit board part by part, and try to put it back together without the actual circuit board. The only way to learn how something works is by taking it apart.

If you lack soldering skills, then you can simply buy a radio shack learners kit (if you haven't already) and make everything in the circuit books. Once you get something to work, try swapping parts and see what happens when you do.
1069  Using Arduino / Project Guidance / Re: touch screen buttons on: January 07, 2014, 09:16:32 pm
The Utouch library has a way to let you see your raw touch data. GetY and GetX. These will let you see if your screen is calibrated or not. There should also be a calibration sketch, if not, then it should be on henning's website.
1070  Using Arduino / Programming Questions / Re: love o meter starting project on: January 07, 2014, 08:57:21 pm
Link
1071  Using Arduino / Project Guidance / Re: Arduino + Bluetooth + Android + Motors on: January 07, 2014, 04:08:20 pm
No, this method should be fine. Are you having issues with the Android side or the Arduino side?

Added:
 I do see that your using Strings and upon testing your code, I noticed your not clearing "received" once it has been used. By you not clearing the String, it continues to concatenate the incoming chars to the String, and this could pose serious memory issues.

I suggest you use C strings (char Array) and the strtok() function.

More:
Here is my test results:
Code:
#include <SoftwareSerial.h>

SoftwareSerial bluetooth(7, 8); // RX, TX

int direcao[] = {
  9, 10};
int motor[] = {
  5, 6};
int ledPin =  13;

int veloc = 0;
String received = "";
char chrreceived;

//Funcao que faz parar
void para(){
  digitalWrite(ledPin, LOW);

  digitalWrite(motor[0], LOW);
  digitalWrite(motor[1], LOW);

  digitalWrite(direcao[0], LOW);
  digitalWrite(direcao[1], LOW);
  delay(25);
}

//Funcao que faz andar para frente
void marchafrente(int velocidade = 255){
  analogWrite(motor[0], velocidade);
  digitalWrite(motor[1], LOW);
}

//Funcao que faz andar para tras
void marchare(int velocidade = 255){
  digitalWrite(motor[0], LOW); 
  analogWrite(motor[0], velocidade); 
}

//Funcao que faz mover para a esquerda
void moveesquerda(int velocidade = 255){
  digitalWrite(direcao[0], LOW);
  analogWrite(direcao[1], velocidade);

  delay(100); 
  digitalWrite(direcao[0], LOW);
  digitalWrite(direcao[1], LOW);   
}

//Funcao que faz mover para a direita
void movedireita(int velocidade = 255){
  analogWrite(direcao[1], velocidade);
  digitalWrite(direcao[1], LOW);

  delay(100); 
  digitalWrite(direcao[0], LOW);
  digitalWrite(direcao[1], LOW); 
}

void setup() {
  //Configurando dados seriais
  Serial.begin(9600);
  bluetooth.begin(9600);

  //Configurando pino do led
  pinMode(ledPin, OUTPUT); 
}

void loop() {
  if (Serial.available() >  0) { //bluetooth
    while(Serial.available() > 0) {//bluetooth
      chrreceived = Serial.read(); //bluetooth
      received.concat(chrreceived);
      //Serial.println(received);   
    }

    if (received.substring(0,2) == "VE") {
      veloc = received.substring(2).toInt();
      Serial.print("Left: ");
      Serial.println(veloc);   

      moveesquerda(veloc);
    }
    else if (received.substring(0,2) == "VD")
    {
      Serial.println();
      veloc = received.substring(2).toInt();
      Serial.print("Right: ");
      Serial.println(veloc);   

      movedireita(veloc);
    }
    else {   
      Serial.print("Key: ");
      Serial.println(chrreceived);
      switch(chrreceived){
        //FRENTE       
      case '8':
      case 'w':
      case 'W':;
        marchafrente();
        break;

        //TRÁS       
      case '2':
      case 's':
      case 'S':
        marchare();
        break;

        //ESQUERDA
      case '4':
      case 'a':
      case 'A':
        moveesquerda();
        break;

        //DIREITA       
      case '6':
      case 'd':
      case 'D':
        movedireita();
        break;

        //PARADO
      case '5':
      case 'p':
      case 'P':
        para();
        break;

        //LIGA LED
      case 'L':
      case 'l':
      case '7':
        digitalWrite(ledPin, HIGH);
        break;

        //DESLIGA LED
      case 'K':
      case 'k':
      case '9':
        digitalWrite(ledPin, LOW);
        break;
      }
    }
  }
  received = "";   
  delay(100); 
}

Output:
Quote
Key: 8

Right: 111
Left: 444
Key: w
Key: W
Key: L
Key: 1

Right: 12
Left: 153
1072  Using Arduino / Project Guidance / Re: Robot arm "control board"... any thoughts? on: January 07, 2014, 03:51:18 am
You can implement the BT module any way you need to. But you also need to think about what you will be using to talk to the BT module, whether it's a computer or mobile device. You can come up with a bunch of commands to look for, or simply relay values.

Keep in mind iPhones and iPad are very picky when it comes to bluetooth modules, so not many of the cheaper modules work.
1073  Using Arduino / Project Guidance / Re: Robot arm "control board"... any thoughts? on: January 07, 2014, 03:00:24 am
His power supply put out 6, 9 and 12 volts at the same time, but it was an old unit and right now I'm having a difficult time finding it.

If you think the Dues 3v3 system will give you problems then your probably better off with a regular Mega Rev3, just to be safe. No point in spending money, only to find out it doesn't work.

This here is the closest I could find to his power supply. LINK
1074  Using Arduino / Project Guidance / Re: Robot arm "control board"... any thoughts? on: January 07, 2014, 02:31:29 am
I would personally go with the Due, it's faster and like the Mega, it has a lot of pins.  Another good reason is of course multiple serial ports, so you don't need to use software serial and risk any of your libraries using a timer that is already being used for the servos.

Interfaces:
It really depends on what you/she plans on doing with it. You could get a TFT with a touch screen to make it look high tech, or use say an android table or IPad via wifi or bluetooth. This would also double as a keypad and other various buttons, if needed. I would include the bluetooth anyways just so you can debug without needing to be connected to a computer.

Power:
There are some really good power units that are also quite compact and provide a good range of voltages. My friend had one, I'll see if I can get the name if it. If anything, you can make your own with a 12V power pack and use regulators to get the required voltages. This is not exactly what he had, but it is very similar 12 volt power supply

Accessibility:
You may want to make a breakout board, one with various connectors like Dupont pins (male and female) and some screw sockets.
1075  Using Arduino / Programming Questions / Re: Brute Force 4 digit code, need correct pin logged on: January 06, 2014, 11:17:13 pm
This sounds familiar to this post HERE
1076  Using Arduino / Project Guidance / Re: Arduino BLE pairing on iPhone on: January 06, 2014, 11:15:09 pm
No, the link I gave you is the modules the DONT work.
1077  Using Arduino / Project Guidance / Re: Arduino BLE pairing on iPhone on: January 06, 2014, 09:56:36 pm
Some modules do work but the normal ones like this HERE, does not.

Do a search for compatible "Arduino bluetooth modules" that work with the Iphone and see what you get.
1078  Using Arduino / Project Guidance / Re: Arduino BLE pairing on iPhone on: January 06, 2014, 09:34:59 pm
The iPhone has a different protocol, so only certain modules are able to be paired. I heard that the GoldSmirf can be paired, but HC - 05/06 modules can't be.
1079  Using Arduino / Programming Questions / Re: Class interfaces and operands on: January 06, 2014, 09:28:09 pm
Can you show us what your getting as an output?
1080  Using Arduino / Project Guidance / Re: love o meter starting project on: January 06, 2014, 09:18:31 pm
Here's your problem. Your IF statements are garbage.
Quote
else if(temperature >= baselineTemp+2 && temperature > baselineTemp){

Use case statements, like so.
Code:
switch( int( temperature ) )
  {
  case 0 ... 19:
    digitalWrite (2,LOW);
    digitalWrite (3,LOW);
    digitalWrite (4,LOW);
    digitalWrite (5,LOW);
    digitalWrite (6,LOW);
    break;

  case 20 ... 22: // not really need to do it like this, its a little much, but I like consistency
    digitalWrite (2,HIGH);
    digitalWrite (3,LOW);
    digitalWrite (4,LOW);
    digitalWrite (5,LOW);
    digitalWrite (6,LOW);
    break;

  case 23 ... 24:
    digitalWrite (2,HIGH);
    digitalWrite (3,HIGH);
    digitalWrite (4,LOW);
    digitalWrite (5,LOW);
    digitalWrite (6,LOW);
    break;

  case 25 ... 26:
    digitalWrite (2,HIGH);
    digitalWrite (3,HIGH);
    digitalWrite (4,HIGH);
    digitalWrite (5,LOW);
    digitalWrite (6,LOW);
    break;

  case 27 ... 28:
    digitalWrite (2,HIGH);
    digitalWrite (3,HIGH);
    digitalWrite (4,HIGH);
    digitalWrite (5,HIGH);
    digitalWrite (6,LOW);
    break;

  case 29 ... 500:
    digitalWrite (2,HIGH);
    digitalWrite (3,HIGH);
    digitalWrite (4,HIGH);
    digitalWrite (5,HIGH);
    digitalWrite (6,HIGH);
    break;
  }
Pages: 1 ... 70 71 [72] 73 74 ... 229