Loading...
  Show Posts
Pages: 1 [2] 3 4
16  Using Arduino / Motors, Mechanics, and Power / Re: DC Motor and poti positioning on: March 08, 2013, 10:15:41 am
heh ok edited sorry for that it should be Precision potentiometer. 10 gears
17  Using Arduino / Motors, Mechanics, and Power / DC Motor and Potentiometer positioning on: March 08, 2013, 09:22:38 am
hey gays i want to make my dc motor to run with a Precision potentiometer. 10 gears left and right when the max or min position its achieved and from reading the serial the motor should position it self
have written some simple code but don't now how to do it further  (didn't make this yet) so heave some understanding and if your could help me further i did it appreciated
Code:
int Enable_A=13;
int Enable_B=8;
int Input_1=12;
int Input_2=11;
int Input_3=10;
int Input_4=9;
int Poti=A0;
int val;

void setup()
{
Serial.begin(115200);
Serial.println("REEDY");
pinMode(Enable_A,OUTPUT);
pinMode(Enable_B,OUTPUT);
pinMode(Input_1,OUTPUT);
pinMode(Input_2,OUTPUT);
pinMode(Input_3,OUTPUT);
pinMode(Input_4,OUTPUT);
}

void loop()
{
while(Serial.available() > 0)
{
char aChar = Serial.read();

if (aChar=='1')
{
Motor_ON();
Serial.print("Motor_ON and running 1_3 ");
Motor_1_3();
Motor_OFF();
}

if (aChar=='2')
{
Motor_ON();
Serial.print("Motor_ON and running 2_4 ");
Motor_2_4();
Motor_OFF();
}
if (aChar=='3')
{
Potie();
}
}
}

void Motor_ON()
{
digitalWrite(Enable_A,HIGH);
digitalWrite(Enable_B,HIGH);
}

void Motor_OFF()
{
delay(100);
digitalWrite(Enable_A,LOW);
digitalWrite(Enable_B,LOW);
Motor_Coast();
Serial.println("STOP");
}

void Motor_1_3()
{
digitalWrite(Input_1,HIGH);
digitalWrite(Input_2,LOW);
digitalWrite(Input_3,HIGH);
digitalWrite(Input_4,LOW);
}

void Motor_2_4()
{
digitalWrite(Input_1,LOW);
digitalWrite(Input_2,HIGH);
digitalWrite(Input_3,LOW);
digitalWrite(Input_4,HIGH);
}

void Motor_Coast()
{
digitalWrite(Input_1,LOW);
digitalWrite(Input_2,LOW);
digitalWrite(Input_3,LOW);
digitalWrite(Input_4,LOW);
Potie();
}

void Potie()
{
val=analogRead(Poti);
Serial.print("Poti = ");
Serial.println(val);
}
18  Using Arduino / Programming Questions / Re: mega and output voltage on: November 05, 2012, 02:00:36 pm
the voltage that i was measured was without  the led and relay that was "clean" output voltage without any consumer between GND and my output pin 23
19  Using Arduino / Programming Questions / mega and output voltage on: November 05, 2012, 12:35:15 pm
hey guys have some issue with my project her the code
Code:
void loop() {
  Usb.Task();
  if(PS3.PS3Connected)
  {
    if(PS3.getButtonPress(DOWN))
   {
     digitalWrite(led_v1,HIGH);
     {
       digitalWrite(led_v1,LOW);
     }
   }
   if (PS3.getAnalogButton(L2_ANALOG) > 0 )
   {
  digitalWrite(led_v6,HIGH);
  delay(5);
  {
  digitalWrite(led_v6,LOW);
  }
   }
   if (PS3.getButtonClick(TRIANGLE))
   {
  digitalWrite(led_v1,HIGH);
   }
  }
}
if i use this  "if(PS3.getButtonPress(DOWN))" my output voltage is 145,5mV
and if i use  "if (PS3.getButtonClick(TRIANGLE))" my output voltage is 4,980V and this is when i use USB cable and when i switch to a dc adapter (7,5V 0,6A)
the voltage is the same i wouldn't bother wit this at all but im use now a 5VDC Relay and a LED 5V and i need fast 4,5V to enable this relay
and if i use deley() the voltage is i around 5V
20  Development / Other Software Development / Re: [Visual Studio 2010] Couldn't determine program size on: November 05, 2012, 11:22:18 am
yep your where a big help
21  Development / Other Software Development / Re: [Visual Studio 2010] Couldn't determine program size on: November 03, 2012, 01:46:05 pm
yes but didint get answer
and this is my second VS project, previous didint make any fuse when i compile it and play with debug
22  Development / Other Software Development / [Visual Studio 2010] Couldn't determine program size on: November 03, 2012, 06:49:10 am
hey guys have some problem with VS i cant build my solution im getting this error
Code:
Compiling 'H-Bridge' for 'Arduino Mega 2560 or Mega ADK'
core.a(main.cpp.o)* : : In function `main':
main.cpp : undefined reference to `setup'
main.cpp : undefined reference to `loop'
avr-objcopy* : : 'C:\Users\THX\AppData\Local\VMicro\Arduino\Builds\H-Bridge\mega2560\H-Bridge.elf': No such file
avr-objcopy* : : 'C:\Users\THX\AppData\Local\VMicro\Arduino\Builds\H-Bridge\mega2560\H-Bridge.elf': No such file
Couldn't determine program size:
on arduino its compiling without any issue can some one help
23  Using Arduino / Motors, Mechanics, and Power / Re: motor runing one lap on: October 30, 2012, 01:45:49 pm
heh its working +/-
24  Using Arduino / Motors, Mechanics, and Power / Re: motor runing one lap on: October 29, 2012, 11:49:27 am
the home position is open
if the motor run the switch is closed
have modified the code
Code:
int motor=2;
int sw=3;
void setup(){
  pinMode(motor, OUTPUT);
  pinMode(sw, INPUT_PULLUP);
  Serial.begin(115200);
  Serial.print("REDY");
}
void loop(){
  while(Serial.available()>0)
  {
    char aChar=Serial.read();
    if (aChar=='g')
    {
      Serial.println("RUN");
      digitalWrite(motor,HIGH);
    }
  }
  if (digitalRead(sw)==HIGH)
  {
    Serial.println("STOP");
    digitalWrite(motor, LOW);
  }
}
but now my serial print STOP all the time and i cant restart the motor
25  Using Arduino / Motors, Mechanics, and Power / Re: motor runing one lap on: October 28, 2012, 02:11:15 pm
like i write i try difrent setups im using PIN 3 to button and PIN 2 for motor
hers some photos
http://imageshack.us/a/img11/5/20121028195540.jpg
http://imageshack.us/a/img713/1323/20121028195220.jpg
26  Using Arduino / Motors, Mechanics, and Power / motor runing one lap on: October 28, 2012, 12:01:56 pm
im trying to make my motor to run  only one lap wait and to run another lap but have some issue
Code:
int motor=2;
int button=3;
void setup(){
  pinMode(motor, OUTPUT);
  pinMode(button, INPUT);
  Serial.begin(115200);
  Serial.print("REDY");
}
void loop(){
  while(Serial.available()>0)
  {
    char aChar=Serial.read();
    if (aChar=='g')
    {
      Serial.println("RUN");
      digitalWrite(motor,HIGH);
      digitalRead(button)==LOW;
    }
  }
  if (digitalRead(button)==HIGH)
  {
    Serial.println("STOP");
    digitalWrite(motor, LOW);
  }
}
i try different setups wit this code but my motor run one lap or he stops and stays stop or hes not runing
27  Using Arduino / Networking, Protocols, and Devices / CAN-BUS Shield as a bridge between auto and a diagnostic program on: October 26, 2012, 02:51:36 pm
hey guys i was wondering if i can use arduino with can-bus shild as a bridge for my diagnostic program and my auto
28  Using Arduino / Project Guidance / Re: serial read echo and servo on: October 15, 2012, 12:19:02 pm
dude i find my self embarrassed
but no one know everything from start
and now the game begin
29  Using Arduino / Project Guidance / Re: serial read echo and servo on: October 15, 2012, 11:54:42 am
Code:
char inData[10];
int index;
boolean started = false;
boolean ended = false;
boolean final = false;
int serialValues[16];
int serialIndex = 0;
const int Pin13 =  13;
const int Pin12 =  12;
const int Pin11 =  11;
const int Pin10 =  10;
int buttonState1 = 0;
int buttonState2 = 0;


  void setup()
    {
    //Serial1.begin(9600);
    Serial.begin(9600);

    //setting pinouts
    pinMode(Pin13, OUTPUT);
    pinMode(Pin12, OUTPUT);
    pinMode(Pin11, INPUT);
    pinMode(Pin10, INPUT);
    }

  void loop()
    {
      buttonState1 = digitalRead(Pin11);
      buttonState2 = digitalRead(Pin10);
     
      while(Serial.available() > 0)
        {
         char aChar = Serial.read();
         if(aChar == '<')
           {
             started = true;
             index = 0;
             inData[index] = '\0';
           }
         else if(aChar == '>')
           {
             ended = true;
           }
       
           else if(started)
           {
             inData[index] = aChar;
             index++;
             inData[index] = '\0';             
             }
         
           else if (aChar =='*')
             {
               final = true;
             }
        }
 

      if(started && ended)
        {
         // Convert the string to an integer
         int inInt = atoi(inData);
           Serial.println(inInt);
         // Use the value
           serialValues [serialIndex] = inInt;
         serialIndex++;
         
           // Get ready for the next time
         started = false;
         ended = false;

         index = 0;
         inData[index] = '\0';     
        }
       
        if(final)
            while(1)
            {
            // loop through the serialValues, and do something
            for(int b=0; b <16;b++ )
             {
             
                int nextVal = serialValues;
                //if serial value is 24 and pin10 is connected to 5V switch led12 on
                if (nextVal == 24 && buttonState2 == HIGH)
                   {
                   digitalWrite(Pin12, HIGH);                                                       
                   }
                 //if serial value is 12 and pin11 is connected to 5V switch led13 on
                 if (nextVal == 12 && buttonState2 == LOW)
                   {
                   digitalWrite(Pin12, LOW);                                                       
                 }
                  Serial.println(b);
                   delay(1000);
             }
            }
    }
   
30  Using Arduino / Project Guidance / Re: serial read echo and servo on: October 15, 2012, 11:32:28 am
u help some how and now have some problem with verifying
Code:
error: invalid conversion from 'int*' to 'int'
and this is the error in code
Code:
int nextVal = serialValues;
Pages: 1 [2] 3 4