Show Posts
Pages: 1 ... 57 58 [59] 60 61 ... 243
871  Using Arduino / Project Guidance / Re: Best wireless connection on: March 16, 2014, 04:38:50 pm
Quote
I don't plan for the receiving to have an Arduino for itself if it doesn't need it.
This can't be done, you need an arduino to receive the signal to control your pins. If you're tight on space, you can use a Nano, Mini or Micro.

Also you don't need to send 8 PWMs at once, what you can do is send a pin number and a PWM for that pin.

Example:
<6, 255> packet one
<9, 129> packet two
.
.
.
<3, 50> packet ten
872  Using Arduino / Project Guidance / Re: Robot wireless mode select on: March 16, 2014, 04:07:27 pm
You can make lastState boolean instead of int , but yea, better.
873  Using Arduino / Project Guidance / Re: Best wireless connection on: March 16, 2014, 03:44:06 pm
A bluetooth module like this link is a lot easier to set up than an xbee modules.

What are you going to use to connect to the BT module to control the lights? Another Arduino or a PC, maybe your phone?
What range are you looking at, Bluetooth can go 30 - 35 ft, but a good xbee can go about 3000ft.
874  Using Arduino / Project Guidance / Re: Robot wireless mode select on: March 16, 2014, 01:22:42 pm
Yea. Thats the way to do it with one button, but the receiver may send out a constant signal. So if you don't block out the constant signal then it will change the state of 's' constantly.

So the better way is:
Code:
boolean state = digitalRead(Stay) ;
if( state != lastState ) [b]// lastState must be set at the top of your code as false[/b]
 {
   if( state == HIGH )
   {
      lastState = state
      s = !s;
    }
 }

You can use the regular two button method, if it is easier for you. But that is what you would need for a single button.
875  Using Arduino / Project Guidance / Re: Robot wireless mode select on: March 16, 2014, 12:25:38 pm
Ok. If you want, you can make it work with a single button. Press it once, it stays; press it again, it follows you. That is done with a latch like you have except it would be written as:

if(digitalRead(Stay) == HIGH) //could be changed to Command instead of Stay
 {
    s = !s; // if the pin is HIGH, set to one and if the pin is HIGH again set back to zero. This will repeat per press.
 }
876  Using Arduino / Project Guidance / Re: Robot wireless mode select on: March 16, 2014, 12:40:58 am
It didn't compile before because you were missing a semicolon on int Follow = 6, but now it does.

You need to read the pin, not compare the pin number to HIGH or LOW. It should be,
Code:
if(digitalRead(Stay) == HIGH)
{
  digitalWrite(LeftB,LOW);
  digitalWrite(RightB,LOW);
  digitalWrite(RightF,LOW);
  digitalWrite(LeftF,LOW);
}

if(digitalRead(Follow) == HIGH)
{
  if (InfraredBall.Direction >= 1 && InfraredBall.Direction < 5)
  {
    digitalWrite(RightF,HIGH);
    digitalWrite(LeftB,HIGH);
    digitalWrite(RightB,LOW);
    digitalWrite(LeftF,LOW);
  }

  if (InfraredBall.Direction > 5 && InfraredBall.Direction <= 9)
  {
    digitalWrite(LeftF,HIGH);
    digitalWrite(RightB,HIGH);
    digitalWrite(RightF,LOW);
    digitalWrite(LeftB,LOW);
  }


  if (InfraredBall.Direction == 5 && inches > 12)
  {
    digitalWrite(LeftF,HIGH);
    digitalWrite(RightF,HIGH);
    digitalWrite(RightB,LOW);
    digitalWrite(LeftB,LOW);
  } 

  if (InfraredBall.Direction == 5 && inches < 3)
  {
    digitalWrite(LeftB,HIGH);
    digitalWrite(RightB,HIGH);
    digitalWrite(RightF,LOW);
    digitalWrite(LeftF,LOW);
  }

  if (InfraredBall.Direction == 5 && inches <= 12 && inches >= 3)
  {
    digitalWrite(LeftB,LOW);
    digitalWrite(RightB,LOW);
    digitalWrite(RightF,LOW);
    digitalWrite(LeftF,LOW);
  }
}
877  Using Arduino / Project Guidance / Re: Robot wireless mode select on: March 15, 2014, 08:50:48 pm
Why did you modify a library? They should be separate, one is a library, the other is a sketch. The sketch includes the library to use is functions. What you have doesn't even compile.

Get them sorted out.

Pressing onward, you already have a way to control whether the robot is to follow or stay, now you just need to toggle it.
Since you already know your going to be using the digital pins to read from the receiver, you can have it read one pin to make Stay equal HIGH, and the other will make Stay equal LOW. It doesn't get any simpler then that.

Quote
if (Stay = HIGH)// something is missing here.
  {
    digitalWrite(LeftB,LOW);
    digitalWrite(RightB,LOW);
    digitalWrite(RightF,LOW);
    digitalWrite(LeftF,LOW);
  }
878  Using Arduino / Project Guidance / Re: Robot wireless mode select on: March 15, 2014, 08:08:42 pm
Quote
Thanks, this is just what i need, now does the transmitter keep transmitting the last button that was pressed or do i need to hold down the button to keep transmitting the signal?
It should be, you press it and it sends a signal then once you let go, the signal stops sending.

Quote
Also I'm already using the 5V pin on my arduino for the ultrasonic sensor so do i hook the receiver up in series or parallel with the ultra sonic sensor.
I do not know the power requirements of the receiver, but the 5V pin should be enough to power both.

Quote
Also one final question the out put pins D0, D1, D2, and D3 on the receiver go the the digital pins on the arduino not the analog pins, right?
Either or, analog pins can work as digital pins, but digital pins cannot read analog signals. They can only produce PWM signals, which are digital representations of an analog signal.
879  Using Arduino / Programming Questions / Re: Interrupt problem on: March 15, 2014, 03:59:17 pm
How is it wired, can you provide a circuit diagram or schematic? Are you using pull down resistors?
Also if you are unaware, the zero in attachInterrupt(0, lifeReduction, RISING); does not mean pin 0, it is pin 2. And this will need a pull down resistor.
880  Using Arduino / Project Guidance / Re: Robot wireless mode select on: March 15, 2014, 03:41:08 pm
If it is something as simple as a toggle switch, then you may want to get one of these. It still might be a little over kill, but four buttons should allow you to add more features than just follow and stay. 315MHz Wireless remote + receiver
881  Development / Other Software Development / Re: Can´t download arduino libraries on: March 15, 2014, 03:31:42 pm
Your post does not belong here in this section, it should be in Project guidance. Actually based on your issue, this isn't an Arduino related problem, its your computers problem so you may want to update it or get it fixed.

I don't know what OS your computer has or why it wont start the download, but if you hold CTRL when you click the download link, it may start. LiquidCrystal

There is one thing you will need to change in the liquidCrystal.h file, and thats this line. #include "Wprogram.h". This line must be changed to #include "Arduino.h", otherwise the library will not work. You can use a regular text editor like notepad or word pad. Just change that one line, then save it. NOT SAVE AS, just save.
882  Development / Other Software Development / Re: New Password Library on: March 15, 2014, 01:28:57 pm
Update!

I've been going through all my past libraries and I decided to add some more things to this library. I  added a few new features, that I think many will enjoy.

Let me know what you think.
883  Using Arduino / Programming Questions / Re: Help with 433 Receiver code on: March 15, 2014, 12:14:53 am
I'm not sure what led you this,
Quote
if (vw_get_message(message, &messageLength)  == 1){
 Serial.println("button: ONE");
}
else if (vw_get_message(message, &messageLength)  == 2){
 Serial.println("button: Two");
}
else if (vw_get_message(message, &messageLength)  == 3){
 Serial.println("button: Three");
}
else if (vw_get_message(message, &messageLength)  == 4){
 Serial.println("button: Four");
}
else if (vw_get_message(message, &messageLength)  == 5){
 Serial.println("button: Five");
}
else if (vw_get_message(message, &messageLength)  == 6){
 Serial.println("button: Six");
}
The reason you always see button: One, is because vw_get_message(uint8_t* buf, uint8_t* len) returns TRUE or 1 if there is a message and 0 if there is not.

But I can tell you that you want to be checking message[0] instead of vw_get_message(message, &messageLength). You know your going to get a value between 1 - 6, so you can use case statements to show what button was pressed.
884  Using Arduino / Programming Questions / Re: Display messages on TFT instead of serial monitor on: March 14, 2014, 09:21:48 pm
If you are also interested in making the screen have more features like buttons, Henning also has a button library, UTFT_Buttons.

I also made an extension library for the UTFT and UTouch libraries, which is similar to UTFT_Buttons, but it has a lot more to it.
Take a look, TFT_Extension, updated library at the bottom of page.
885  Using Arduino / Project Guidance / Re: Skip subroutine on: March 13, 2014, 09:13:36 pm
Can you post the code. Make sure it is in code tags, its the # above the smiley faces. [ code ] ... [/ code ]
Pages: 1 ... 57 58 [59] 60 61 ... 243