Loading...
  Show Posts
Pages: [1] 2 3 ... 26
1  Using Arduino / Project Guidance / Re: Project qurrey on: March 04, 2013, 10:49:52 am
http://www.sparkfun.com/tutorials/269
2  Using Arduino / Project Guidance / Re: Need help with limit switch and steppermotor on: March 04, 2013, 10:26:12 am
well 3nsio, its ok if you post a newbie code on here, we are here to help you .To help you learn and together we grow and expand our knowledge. Anyway heres some pointer for you to look at
  • Finite State Machine
  • maybe A do while loop would be great too
3  Using Arduino / Project Guidance / Re: Project qurrey on: March 04, 2013, 06:36:00 am
well did you ever go to the dentist and they have a cup that will be fill, and as the cup get filled, it will automatically turn off the tap? i think that if you use the same idea but instead of using just a normal switch use a force resistor under the cup. it might not be accurate enough but maybe it might work for your application.
4  Using Arduino / Project Guidance / Re: Sketch too long - need help with the project on: March 04, 2013, 06:29:24 am
i think whats the op is asking, is there any library that could manage all the library that he is currently using so that he could shrink the size of his code
5  Using Arduino / Project Guidance / Re: Need help with limit switch and steppermotor on: March 04, 2013, 06:27:01 am
could you show us your code so that we can help you more
6  Using Arduino / Project Guidance / Re: Two analog sensors controlling PWM on: March 03, 2013, 11:53:56 am
well then if thats the case i stand corrected AWOL, i learn new thing each and every single day here at the forum. Awol Thank you
7  Using Arduino / Project Guidance / Re: Two analog sensors controlling PWM on: March 03, 2013, 11:47:37 am
@ash901226
Quote
You should know that this part wont work,
Why ever not?
Awol as i wrote in reply #2
Quote
You should know that this part wont work, well it will but not the way you want it to be

from my understanding, the op wanted to use Analog pin, However from my limited knowledge of arduino, when someone wish to use the Analog pin, he/she have to write an A before the digit so that the arduino compiler know that the programmer requested to the Analog pin. I do how ever know that analog pin can also be call bit its pin number like for instant A0-A5 can be called as pin 14-19
8  Using Arduino / Project Guidance / Re: Two analog sensors controlling PWM on: March 03, 2013, 11:26:56 am
You should know that this part wont work, well it will but not the way you want it to be
Code:
// Naming the analog pins:
      int analog_pin_0 = 0;
      int analog_pin_1 = 1;
      int analog_pin_2 = 2;
      int analog_pin_3 = 3;
      int analog_pin_4 = 4;
      int analog_pin_5 = 5;

The right way to declare an analog pin is by using A0 to A5 in your case like this
Code:
// Naming the analog pins:
      int analog_pin_0 = A0;
      int analog_pin_1 = A1;
      int analog_pin_2 = A2;
      int analog_pin_3 = A3;
      int analog_pin_4 = A4;
      int analog_pin_5 = A5;

one part that i an wondering is that
Quote
I am working on a project that takes the input of two analog sensors and outputs one PWM signal as a function of the two.

but in your code
Code:
T_min = analogRead(analog_pin_0);
      T_max = analogRead(analog_pin_1);
      T = analogRead(analog_pin_2);
   ......
      P_min = analogRead(analog_pin_3);
      P_max = analogRead(analog_pin_4);
      P = analogRead(analog_pin_5);

do you use 2 or 6 Analog pin?

if you are using 2 analog input and you want min, max and current value something along this line should work

Code:
int min = 1023;
int max = 0;

int current = analogRead(A0) // Just and example
if ( current < min) min= current;
if ( current > max) max = current;
int Tout = (((1023/ (t_max - t_min)) * (t - t_min))/4);

you know for the output part you do not need any conditioning since the arduino know if 0 its equal to low and 255 equal to high so

Code:
analogWrite(pin_f_out, final_out);
would have been enough
9  Using Arduino / Project Guidance / Re: Reaction time test circuit. on: March 03, 2013, 10:00:24 am
try not to use delay could you?
10  Using Arduino / Project Guidance / Re: Guidance with deboucing on: March 03, 2013, 09:50:55 am
try this code maybe it will help u
Code:
uint8_t Switch = 2;
uint8_t Led =13;

boolean LedState =LOW;
int SwitchState =0;
int SwitchDebounce;
int LastSwitchState=HIGH;
int LastSwitchDebounce=LOW;

unsigned long LastDebounceTime = 0;
unsigned long DebounceDelay = 50;

void setup()
{
  pinMode(Switch,INPUT);
  digitalWrite(Switch,HIGH);
  pinMode(Led,OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  int CurrentSwitch = digitalRead(Switch);
  if (CurrentSwitch != LastSwitchDebounce)
  {
    LastDebounceTime = millis();
  }
  if ((millis() - LastDebounceTime) > DebounceDelay)
  {
    SwitchState = digitalRead(Switch);
    if (SwitchState != LastSwitchState)
    {
      if (SwitchState == LOW)
      {
        LedState = !LedState;
        (LedState)?Serial.println("Led is On"):Serial.println("Led is Off");
      }
    }
    LastSwitchState=SwitchState;
  }
  digitalWrite(Led,LedState);
  LastSwitchDebounce = CurrentSwitch;
}
11  Using Arduino / Motors, Mechanics, and Power / Re: 30RPM Worm Drive on: February 21, 2013, 03:53:56 am
one option is to use a stepper motor...
wiper motor is an option you cannot overlook
12  Using Arduino / Motors, Mechanics, and Power / Re: L298n, Do I need flyback diodes? on: February 21, 2013, 03:52:07 am
yes you do since ln298 dont have internal flyback diode
13  Using Arduino / Programming Questions / Re: cruise control on motorcycle, need to read timing between wheel RPMs on reed swi on: February 12, 2013, 01:04:15 pm
i have this piece of code that maybe you could tinker with, what it does is if you press a switch that is connected to pin 2 on the arduino board, like so

pin2------|/|-----Ground

the code will measure how long the switch was press and will light up the on board led (pin 13) the same amount of time that the switch was press after the switch was release

Code:
uint8_t Switch = 2;
uint8_t Led =13;

boolean LedState =LOW;
int SwitchState =0;
int SwitchDebounce;
int LastSwitchState=HIGH;
int LastSwitchDebounce=LOW;

unsigned long LastDebounceTime = 0;
unsigned long DebounceDelay = 50;
unsigned long TimeRelease=0;
unsigned long TimePress=0;

void setup()
{
  pinMode(Switch,INPUT);
  digitalWrite(Switch,HIGH);
  pinMode(Led,OUTPUT);
  digitalWrite(Led,LOW);
}

void loop()
{
  int CurrentSwitch = digitalRead(Switch);
  if (CurrentSwitch != LastSwitchDebounce)
  {
    LastDebounceTime = millis();
  }
  if ((millis() - LastDebounceTime) > DebounceDelay)
  {
    SwitchState = digitalRead(Switch);
    if (SwitchState != LastSwitchState)
    {
      if(SwitchState)
      {
        TimeRelease=millis();
        digitalWrite(Led,HIGH);
      }
      if (!SwitchState)
      {
        TimePress=millis();
      }
      LastSwitchState=SwitchState;
    }
  }
  if ((millis()-TimeRelease)>=(TimeRelease-TimePress))
  {
    digitalWrite(Led,LOW);
  }
  LastSwitchDebounce = CurrentSwitch;
}

14  Using Arduino / Programming Questions / Re: Simple count down timer problem on: February 12, 2013, 12:21:53 pm
Arduino take a sequence of number and treat every digit as its own digit. what you need is someway of telling the arduino that the sequence of number is not just a single digit thing but a whole.

i found out that sending a terminator help alot
maybe you could use a special character like "/" or "*" as to tell the arduino this is the end

like
Code:
while(Serial.read()!="/")
{
  int val=Serial.read;
  int Sum=Sum*10+val;
  }
the snippet does not work, but it should show you how it is done.
15  Using Arduino / Motors, Mechanics, and Power / Re: controlling two transistors with same port on: February 12, 2013, 08:47:50 am
what your asking is consider as a push pull transistor circuit, althought i cant really get what your wiring do, heres a link for you to read on
http://en.wikipedia.org/wiki/Push%E2%80%93pull_output

one thing you need to consider is that, never switch on the same side at the same time since it will produce a dead short
Pages: [1] 2 3 ... 26