Show Posts
Pages: 1 ... 35 36 [37] 38 39 ... 196
541  Using Arduino / Programming Questions / Re: Program for keypads on: January 12, 2014, 03:07:17 pm
Where did you put the library? It should be in a "libraries" folder in the Arduino sketch folder, which should be located in your Mydocuments.
542  Using Arduino / Programming Questions / Re: Program for keypads on: January 12, 2014, 02:58:01 pm
 Should be capital
#include <keypad.h>

These don't match.
void setLocked(int Locked){
  if (locked)
543  Using Arduino / Programming Questions / Re: 315 MHz Tx and Rx problems. on: January 11, 2014, 10:16:23 pm
In the picture with your transmitter, you have the data line on pin 39, but your transmitter's code is set for pin 3. Which one is it really?
544  Using Arduino / Programming Questions / Re: Compile Error ? on: January 11, 2014, 05:43:50 pm
Quote
LiquidCrystal_I2C lcd(0x3F,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line
display
Take display out.
545  Using Arduino / Programming Questions / Re: Controlling two+ servos over a serial connection, problem with arrays? on: January 11, 2014, 04:06:39 pm
Look into sprintf and either strtok or parsing data.
546  Using Arduino / Project Guidance / Re: Controlling the Arduino with an Android over Bluetooth? on: January 10, 2014, 11:59:13 pm
Try this code.
Code:
/*
 Example sketch for the RFCOMM/SPP Bluetooth library - developed by Kristian Lauszus
 For more information visit my blog: http://blog.tkjelectronics.dk/ or
 send me an e-mail:  kristianl@tkjelectronics.com
 */

#include <SPP.h>
USB Usb;
BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so
/* You can create the instance of the class in two ways */
SPP SerialBT(&Btd); // This will set the name to the defaults: "Arduino" and the pin to "1234"
//SPP SerialBT(&Btd, "Lauszus's Arduino","0000"); // You can also set the name and pin like so
char val;
boolean firstMessage = true;

void setup() {
  Serial.begin(115200);
  pinMode(3, OUTPUT);
  if (Usb.Init() == -1) {
    Serial.print(F("\r\nOSC did not start"));
    while(1); //halt
  }
  Serial.print(F("\r\nSPP Bluetooth Library Started"));
}
void loop() {
  Usb.Task();
  if(SerialBT.connected) {
    if(firstMessage) {
      firstMessage = false;
      SerialBT.println(F("Hello from Arduino")); // Send welcome message
    }
    if(Serial.available())
      SerialBT.print(Serial.read());

    if(SerialBT.available())
    {
      val = SerialBT.read();     
      Serial.println(val);
      if( val == 'H' || val == 'h' )               // if 'H' was received
      {
        digitalWrite(3, HIGH);  // turn ON the LED
      }
      if( val == 'L' || val == 'l' )
      {
        digitalWrite(3, LOW);   // otherwise turn it OFF
      }
    }
  }
  else
    firstMessage = true;
}
547  Using Arduino / Project Guidance / Re: Distributing current evenly between two parallel programmes on: January 10, 2014, 06:22:12 pm
The LEDs draw whatever current they need, you don't really have any control over that. Why do you think you need to balance the current?
548  Using Arduino / Project Guidance / Re: Hey, need some help on where to start programming! (Balancing Bot) on: January 10, 2014, 06:20:03 pm
If the gyro is on a flat surface, I would imagine the numbers should not be fluctuating.
549  Using Arduino / Programming Questions / Re: ping sensor works but all LEDs are lit up? on: January 10, 2014, 04:31:51 pm
Quote
long duration, inches;  Take these out of your code, throw them away, then burn the garbage.
ping.inches() == (duration/2) / 29.1;

  if (ping.inches() <= 27) { // sample IF statement, do this for the rest of them.

550  Using Arduino / Project Guidance / Re: Controlling the Arduino with an Android over Bluetooth? on: January 10, 2014, 01:44:51 am
Quote
So, an example, I press 'a' on the keyboard of my Android and the Arduino detects the button I pressed and displays it on the Serial Monitor. I did this by using example provided in the USB Host Library called "SPP".
Ok, so you can get data from the Android with Serial.write(SerialBT.read()); and see it on the serial monitor. So in the example I gave you, change Serial.read() to SerialBT.read() and see if that helps.

Also from my example, only copy what you need. You don't need the whole thing, just the IF statements.
551  Using Arduino / Programming Questions / Re: Wierd Single LED SOS on: January 10, 2014, 01:11:48 am
Use the on-board LED on pin 13, and see if that changes anything. Simply change the 10 (ledPin) to 13 in your code.
552  Using Arduino / Project Guidance / Re: Controlling the Arduino with an Android over Bluetooth? on: January 10, 2014, 01:08:36 am
This here is a basic code that uses a Serial connection to compare the incoming char to a specific char to change the state of the LED. It should be quite the same with your particular library.

Code:
char val; // variable to receive data from the serial port
int ledpin = 13; // LED connected to pin 13 (on-board LED)


void setup() {
  pinMode(ledpin, OUTPUT);  // pin 13 (on-board LED) as OUTPUT
  Serial.begin(9600);       // start serial communication at 9600bps
  delay(10);               // 10 millisecond delay between starting the serial communication and sending out a message
  Serial.println("get data");    // read it and store it in 'val'
}

void loop() {

  if( Serial.available() > 0)       // if data is available to read
  {
    val = Serial.read();
    Serial.println(val);
    if( val == 'H' || val == 'h' )               // if 'H' was received
    {
      digitalWrite(ledpin, HIGH);  // turn ON the LED
    }
    if( val == 'L' || val == 'l' )
    {
      digitalWrite(ledpin, LOW);   // otherwise turn it OFF
    }
  }
}
553  Using Arduino / Programming Questions / Re: Wierd Single LED SOS on: January 10, 2014, 12:59:33 am
So it works now or still no?
554  Using Arduino / Programming Questions / Re: Wierd Single LED SOS on: January 10, 2014, 12:50:05 am
Is the LED grounded?
555  Using Arduino / Project Guidance / Re: Controlling the Arduino with an Android over Bluetooth? on: January 10, 2014, 12:48:09 am
Well, you can check the incoming char and compare it to the character 'A' or 'a' and if they match, LED ON, if not then LED OFF.
Pages: 1 ... 35 36 [37] 38 39 ... 196