Show Posts
Pages: 1 ... 17 18 [19] 20 21 ... 239
271  Using Arduino / Project Guidance / Re: ?? Best way to control a robot wirelessly on: June 30, 2014, 01:32:25 pm
Well if you want to control it from anywhere then yes, but keep in mind your bandwidth, and location.

Video (depending on the format and compression) takes a good amount of bandwidth, so your bound to get some lag. Also if your robot is surrounded by too much metal, buildings or other structures, you may also get lag.

I personally would design it to have two methods of control, one web based for long distances and the other maybe Bluetooth for close distances (Although, most if not all arduino Bluetooth modules don't do video, or at least not so well)

Perhaps some other members will share their insight.
272  Using Arduino / Project Guidance / Re: ?? Best way to control a robot wirelessly on: June 30, 2014, 01:13:16 pm
Quote
I have heard from one of the forum members that wifi shield is not very reliable.
Hmm, I haven't heard anything about that, but I'll keep it in mind.

273  Using Arduino / Project Guidance / Re: ?? Best way to control a robot wirelessly on: June 30, 2014, 12:54:49 pm
Quote
ethernet shield

A Wifi shield will give you more mobility.

Another option would be to make your own controller from a second arduino and control it that way. This is good if you're going to be within a close proximity, then you can use RF modules or Bluetooth modules.

How exactly are you going to control it, PC or smart phone?

RF modules:
433/315 Mhz (comes in pairs, transmitter and receiver, One direction comm) : LINK

Bluetooth (need 2 module for master and slave): LINK
274  Using Arduino / Project Guidance / Re: help to create remote controled count down on: June 30, 2014, 12:31:32 pm
Here is a simple count down timer.
Code:
long time = millis();
int M,Min, S, Sec;
boolean Reset = false, Stop = false, Paused = false;
volatile boolean timeFlag = false;

void setup()
{
  Serial.begin(115200);
  StartTimer(0,10);   
  // if minutes is set to NULL, it will be give a default value of 0, otherwise minutes will be set to input value
  // seconds is basically the same but its default value is 59
}

void loop()
{
  if( !CountDownTimer() ) // check if the timer has reached 0
  {
    //ResetTimer(); // if it has, reset the timer. *OPTIONAL*
  } 

  if(TimeHasChanged() ) // this prevents the time from being constantly shown.
  {
    Serial.print(ShowMinutes());
    Serial.print(":");
    Serial.println(ShowSeconds()); // This DOES NOT format the time to 0:0x when seconds is less than 10.
    // if you need to format the time to standard format, use the sprintf() function.
  }
 
  StopTimerAt(0,2); // With this, you can stop the timer at any minute or second
}

boolean CountDownTimer()
{
  timeFlag = false;
  if(!Stop && !Paused) // if not Stopped or Paused, run the timer
  {
    if(millis() - time > 1000) // check the time difference and see if 1 second has elapsed
    {
      time = millis(); // 1 second HAS elapsed, so reset the time variable
      S > 0? S-- : (M-- , S = 59); // Check to see if S can be decremented and is still above 0.
      // If S goes below 0, reset it back to 59 and decrement M by
      timeFlag = true;

      if(M == 0 && S == 0) // check to see if both M and S are 0
          Stop = true; // If so, stop the timer
    }
  }
  return !Stop; // return the state of the timer
}

void ResetTimer()
{
  StartTimer(Min, Sec);
  Stop = false;
}

void StopTimer()
{
  Stop = true;
}

void StopTimerAt(int minutes, int seconds)
{
  if(minutes == ShowMinutes() && seconds == ShowSeconds())
    Stop = true;
}

void PauseTimer()
{
  Paused = true;
}

void ResumeTimer() // You can resume the timer if you ever stop it.
{
  Paused = false;
}

void StartTimer(int minutes, int seconds)
{
  Min = minutes; // set to global vars
  Sec = seconds; // ------------------
 
  (minutes == NULL) ? M = 0 : (M = minutes - 1);
  (seconds == NULL) ? S = 60: (S = seconds);
  Stop = false;
}

int ShowMinutes()
{
  return M;
}

int ShowSeconds()
{
  return S;
}

boolean TimeHasChanged()
{
  return timeFlag;
}

boolean TimeCheck(int minutes, int seconds) // output is true if timer equals requested time
{
  return (minutes == ShowMinutes() && seconds == ShowSeconds());
}
275  Using Arduino / Project Guidance / Re: help to create remote controled count down on: June 30, 2014, 07:51:29 am
This is easy enough to where you can write the code, but I can make a sample you can learn from.
276  Using Arduino / Project Guidance / Re: help to create remote controled count down on: June 29, 2014, 10:02:04 pm
You will need to add the rest of the numbers 0 - 9 and do some math to see what values you need to show based on the counter.

There should be pre-built 7 segment displays that have a library you can use to get them to work. This might be easier for you then wiring everything up and hoping for the best. But that's up to you.

As for you displays, (depending what you do) you need to look at the counter and see if it is greater or less than 10. This will tell your code what to display on each 7 segment disp. The first display will show 0 - 9 and the second will only show 0 and 1.

Quote
if i want to create a big  7 segment  using 5 led/segment
Get a prebuilt display for this.
277  Using Arduino / Project Guidance / Re: help to create remote controled count down on: June 29, 2014, 08:27:12 pm
You add it where you need to, whatever button you want to use to reset it.
I don't know the IR button codes.
278  Using Arduino / Project Guidance / Re: help to create remote controled count down on: June 29, 2014, 08:15:26 pm
Quote
i want to change the code to add reset function ( make the counter 0)

I added it while you are typing.
279  Using Arduino / Project Guidance / Re: help to create remote controled count down on: June 29, 2014, 08:03:45 pm
A single 7 segment display? Where is that in your code? Or are you setting the display with pin 2 - 8?

I cleaned up your code a little bit.

Code:
#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

byte numbers[] = {
  B0010000, B1011011, B0001100, B0001001, B1000011 }; // insert the rest of the display values here

long time = millis();
byte idx = 0;

void setup()
{
  Serial.begin(9600);
  for(byte i = 2; i < 9; i++)
    pinMode(i, OUTPUT);
  irrecv.enableIRIn(); // Start the receiver
}

void loop()
{
  if (irrecv.decode(&results))
  {
    Serial.println(results.value );
    if(results.value==2706322374)
    {
      decompteur(4);
      irrecv.resume(); // Receive the next value
    }
    else if(results.value==1231570528)
    {
      decompteur(2);
      irrecv.resume(); // Receive the next value
    }
    irrecv.resume(); // Receive the next value
  }
}

void decompteur(byte n)
{
  if( millis() - time >= 60*1000)
  {
    if(idx < n)
    {
      for(byte num = 0; num < 7; num++)
        digitalWrite(num+2, bitRead(numbers[n - idx], num) );
      idx++;
    }
    else
      idx = 0;

    time = millis();
  }
}

void resetCounter() // call this function to reset the counter back to zero if you need to.
{
  idx = 0;
}
280  Using Arduino / Project Guidance / Re: help to create remote controled count down on: June 29, 2014, 07:33:16 pm
What does the count down timer control? Is it on for the set time duration or does it start once the timer is done?
281  Using Arduino / Project Guidance / Re: help to create remote controled count down on: June 29, 2014, 06:50:56 pm
Where is the code you made or have?
282  Using Arduino / Project Guidance / Re: Stepper Motor Help on: June 29, 2014, 06:30:46 pm
But does the stepper move?

Quote
The run() function will try to move the motor (at most one step per call) from the current position to the target position set by the most recent call to this function. Caution: moveTo() also recalculates the speed for the next step. If you are trying to use constant speed movements, you should call setSpeed() after calling moveTo().


Add this instead.
Serial.print(val);
Serial.print(" ");
Serial.println(stepper1.currentPosition());
283  Using Arduino / Project Guidance / Re: help to create remote controled count down on: June 29, 2014, 06:22:17 pm
Sure.

The delay function should not be used when you are waiting for something else to happen. IE,
Quote
i cant get reset commande from the ir remote ; i get it only if the delay finish
Because it results in this happening.

So delay(10*60*1000) is going to block you from doing anything for 10 minutes. This is 10 minutes of wasted time when the Arduino could be doing something else while its waiting for the 10 minutes to elapse.

You want to use a non blocking method like the one used in the Arduino example "Blink Without Delay". In this example, it shows you how to do something without waiting for something else to be finished. This is the Arduinos way of multitasking on a single thread processor.
284  Using Arduino / Project Guidance / Re: Stepper Motor Help on: June 29, 2014, 06:13:40 pm
These go in the setup() function:
Code:
stepper1.setMaxSpeed(1000.00);
  stepper1.setAcceleration(900.0);
  stepper1.setSpeed(350);

This value is never changing:
  Serial.println(currentPos);

What does this show?
  Serial.println(val);

Take a look at the examples provided with this library. AccelStepper
285  Using Arduino / Project Guidance / Re: help to create remote controled count down on: June 29, 2014, 06:06:18 pm
Delay() blocks the code from doing anything until it is done, so you need a non-blocking method. Look into the example sketch, Blink Without Delay.
Pages: 1 ... 17 18 [19] 20 21 ... 239