Show Posts
Pages: 1 2 3 [4] 5 6
46  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
47  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
48  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
49  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
50  Using Arduino / Motors, Mechanics, and Power / Re: motor runing one lap on: October 30, 2012, 01:45:49 pm
heh its working +/-
51  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
52  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
53  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
54  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
55  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
56  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);
             }
            }
    }
   
57  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;
58  Using Arduino / Project Guidance / serial read echo and servo on: October 14, 2012, 12:56:01 pm
i want to write code for my arduino for echo communication but have some problem
the code should look more or less like this
if i send to serial monitor "L90" he should turn my servo to left 90 degrees
can some one help?
59  Using Arduino / Motors, Mechanics, and Power / controling motors with PS3Pad on: October 06, 2012, 09:17:43 am
hey looking for some help writhe code for controlling a H-brige shield with the PS3Pad
i have writhe some basic code but then arduino don't respond to the "second command" that is if i press first TRIANGLE motor runs left but i i press CIRCLE nothing happening and same story i i press CIRCLE motor runs right but i press TRIANGLE nothing happening can some one help
Code:
void setup(){
  Serial.begin(115200);
  Usb.Init();
  if (Usb.Init() == -1) {
    Serial.print(F("\r\nOSC did not start"));
    while(1); //halt
  } 
  Serial.print(F("\r\nPS3 USB Library Started"));   
  servoOne.attach(2); // attaches the first servo on pin 0 to the servo object
  servoTwo.attach(3); // attaches the first servo on pin 1 to the servo object
 
}

void loop(){
  Usb.Task(); // perform the regular USB routines 
  if(PS3.PS3Connected || PS3.PS3NavigationConnected) {   
    if(PS3.buttonPressed){ // right and left buttons change mode joystick/Accelerometer   
      if(PS3.getButton(LEFT)) {       
        servomode = 0;
        PS3.setAllOff();
        PS3.setLedOn(LED2);
        Serial.println(F("SERVOMODE 0"));
      }
      if(PS3.getButton(RIGHT)) {       
        servomode = 1;
        PS3.setAllOff();         
        PS3.setLedOn(LED3);
       Serial.println(F("SERVOMODE 1"));
      }
    }   
    if(servomode){ // Accelerometer mode   
      PositionOne = constrain(PS3.getAnalogHat(LeftHatX), 400, 600); // constrain to +/- 1g
      PositionOne = map(PositionOne, 400, 600, 0, 179); // scale it to use it with the servo
      PositionTwo = constrain(PS3.getAnalogHat(LeftHatY), 400, 600); // constrain to +/- 1g
      PositionTwo = map(PositionTwo, 400, 600, 0, 179); // scale it to use it with the servo
    }
    else{ // Joystick mode
      PositionOne = map(PS3.getButton(TRIANGLE), 0, 255, 0, 179); // scale it to use it with the servo
      PositionTwo = map(PS3.getButton(CIRCLE), 0, 255, 0, 179); // scale it to use it with the servo
    }
  } 
  servoOne.write(PositionOne); //sets the first servo position according to the scaled value
  servoTwo.write(PositionTwo); // sets the first servo position according to the scaled value
  delay(15); // waits for the servo low time
}
60  Using Arduino / Motors, Mechanics, and Power / PS3BT + Servo on: September 23, 2012, 10:32:17 am
Hey guys i have some problem with my code after uploading it to arduino PS3Pad get connected nothing happens my servo dont react
hers the code
Code:
#include <Servo.h>
#include <Spi.h>
#include <PS3BT.h>

Servo servoOne; // create servo object for first Servo
Servo servoTwo; // create servo object for second Servo
USB Usb;
BTD Btd(&Usb);
PS3BT PS3(&Btd, 0x00, 0x02, 0x5B, 0x00, 0x29, 0x50);
int PositionOne, PositionTwo; //storage for servo positions
char servomode; // mode for servo control 0 = joystick 1 = accelerometer
boolean printTemperature;
boolean printAngle;

void setup(){
  Serial.begin(115200);
  Usb.Init();
  if (Usb.Init() == -1) {
    Serial.print(F("\r\nOSC did not start"));
    while(1); //halt
  } 
  Serial.print(F("\r\nPS3 USB Library Started"));   
  servoOne.attach(2); // attaches the first servo on pin 0 to the servo object
  servoTwo.attach(3); // attaches the first servo on pin 1 to the servo object
 
}

void loop(){
  Usb.Task(); // perform the regular USB routines 
  if(PS3.PS3Connected || PS3.PS3NavigationConnected) {   
    if(PS3.buttonPressed){ // right and left buttons change mode joystick/Accelerometer   
      if(PS3.getButton(LEFT)) {       
        servomode = 0;
        PS3.setAllOff();
        PS3.setLedOn(LED2);
        Serial.println(F("SERVOMODE 0"));
      }
      if(PS3.getButton(RIGHT)) {       
        servomode = 1;
        PS3.setAllOff();         
        PS3.setLedOn(LED3);
       Serial.println(F("SERVOMODE 1"));
      }
    }   
    if(servomode){ // Accelerometer mode   
      PositionOne = constrain(PS3.getAnalogHat(LeftHatX), 400, 600); // constrain to +/- 1g
      PositionOne = map(PositionOne, 400, 600, 0, 179); // scale it to use it with the servo
      PositionTwo = constrain(PS3.getAnalogHat(LeftHatY), 400, 600); // constrain to +/- 1g
      PositionTwo = map(PositionTwo, 400, 600, 0, 179); // scale it to use it with the servo
    }
    else{ // Joystick mode
      PositionOne = map(PS3.getButton(TRIANGLE), 0, 255, 0, 179); // scale it to use it with the servo
      PositionTwo = map(PS3.getButton(CIRCLE), 0, 255, 0, 179); // scale it to use it with the servo
    }
  } 
  servoOne.write(PositionOne); //sets the first servo position according to the scaled value
  servoTwo.write(PositionTwo); // sets the first servo position according to the scaled value
  delay(15); // waits for the servo low time
}
servo is SG-5010 Tower Pro
Pages: 1 2 3 [4] 5 6