Show Posts
|
|
Pages: 1 2 [3] 4
|
|
31
|
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?
|
|
|
|
|
32
|
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 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 }
|
|
|
|
|
33
|
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 #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
|
|
|
|
|
34
|
Using Arduino / Project Guidance / Re: robot arm + arduino uno
|
on: August 08, 2012, 12:24:36 pm
|
|
servo is for nob im a nob now but want to skipped that and build something dissent have fast all but dont now how to write the code do i need to include button push in the code or can i make that in a different way
|
|
|
|
|
35
|
Using Arduino / Project Guidance / Re: robot arm + arduino uno
|
on: August 06, 2012, 12:45:49 pm
|
dont now if u see this  he have a small joystick witch go in 4 axes and a small roll but next q is that the adfruit motor shield can run only 4 dc motor and i was thinking that the one from the rotting 270° connect alls a steeper but let me now if there is a shield that can handle up to 6 dc motors or i need to build
|
|
|
|
|
37
|
Using Arduino / Project Guidance / robot arm + arduino uno
|
on: August 05, 2012, 06:20:19 am
|
hey guys some time ago my brain had a idea why not build a robot arm controlling with a joystick and using arduino uno i have the all ingredients but now i need some programing i am using arduino uno + USB Host Shield + Adfruit Motor Shield i have connected the usb host shield upload code plug in my joystick works perfect same with adfruit motor shield now i need a little guidance (assume google) in hooking the code in overview it should look like this Joystick give the command to motor simply as possible any one have same idea or are im the first one 
|
|
|
|
|
39
|
Using Arduino / Installation & Troubleshooting / uno and error at verifying
|
on: July 29, 2012, 08:00:01 am
|
Hey guys starting today i have this annoying problem i cant verifying or upload my projects to Arduino UNO i get this message: In file included from \arduino-1.0\hardware\arduino\cores\arduino\/Arduino.h:212, \arduino-1.0\hardware\arduino\cores\arduino\/wiring_private.h:33, \arduino-1.0\hardware\arduino\cores\arduino\wiring_digital.c:28: \arduino-1.0\hardware\arduino\cores\arduino\/pins_arduino.h:90: error: 'DDRA' undeclared here (not in a function) \arduino-1.0\hardware\arduino\cores\arduino\/pins_arduino.h:94: error: 'DDRE' undeclared here (not in a function) \arduino-1.0\hardware\arduino\cores\arduino\/pins_arduino.h:95: error: 'DDRF' undeclared here (not in a function) \arduino-1.0\hardware\arduino\cores\arduino\/pins_arduino.h:96: error: 'DDRG' undeclared here (not in a function) \arduino-1.0\hardware\arduino\cores\arduino\/pins_arduino.h:97: error: 'DDRH' undeclared here (not in a function) \arduino\cores\arduino\/pins_arduino.h:99: error: 'DDRJ' undeclared here (not in a function) \arduino\cores\arduino\/pins_arduino.h:100: error: 'DDRK' undeclared here (not in a function) \arduino\cores\arduino\/pins_arduino.h:101: error: 'DDRL' undeclared here (not in a function) \arduino\cores\arduino\/pins_arduino.h:106: error: 'PORTA' undeclared here (not in a function) \arduino\cores\arduino\/pins_arduino.h:106: error: initializer element is not constant \arduino-1.0\hardware\arduino\cores\arduino\/pins_arduino.h:133: error: (near initialization for 'port_to_input_PGM[12]')
but if i try upload that same project on my mega its runs without a problem
|
|
|
|
|
44
|
Using Arduino / Installation & Troubleshooting / Re: Arduino USB host Shild
|
on: July 07, 2012, 01:20:51 pm
|
ok now i now how to put the lib to arduino but still i get some errors ../hidusagestr.h:431: warning: only initialized variables can be placed into program memory area ../hidusagestr.h:432: warning: only initialized variables can be placed into program memory area ../hidusagestr.h:433: warning: only initialized variables can be placed into program memory area ../hidusagestr.h:434: warning: only initialized variables can be placed into program memory area ../hidusagestr.h:435: warning: only initialized variables can be placed into program memory area ../hidusagestr.h:436: warning: only initialized variables can be placed into program memory area ../hidusagestr.h:437: warning: only initialized variables can be placed into program memory area ../hidusagestr.h:438: warning: only initialized variables can be placed into program memory area ../hidusagestr.h:439: warning: only initialized variables can be placed into program memory area . . . . ../hidusagestr.h:919: warning: only initialized variables can be placed into program memory area ../hidusagestr.h:920: warning: only initialized variables can be placed into program memory area Invoking: AVR C++ Linker ../hidusagestr.h:921: warning: only initialized variables can be placed into program memory area avr-gcc -Os -Wl,--gc-sections -L"D:\Dokumenty\Dev\Arduino_Mega_2560_or_Mega_ADK/Release" -mmcu=atmega2560 -o"USBHIDJoystick.elf" ./USBHIDJoystick.o ./hidjoystickrptparser.o -l"Arduino_Mega_2560_or_Mega_ADK" -lm ../hidusagestr.h:922: warning: only initialized variables can be placed into program memory area ../hidusagestr.h:923: warning: only initialized variables can be placed into program memory area ../hidjoystickrptparser.cpp: In member function 'virtual void JoystickReportParser::Parse(HID*, bool, uint8_t, uint8_t*)': ../hidjoystickrptparser.cpp:53: warning: suggest explicit braces to avoid ambiguous 'else' ./USBHIDJoystick.o: In function `__static_initialization_and_destruction_0': D:\Dokumenty\Dev\USBHIDJoystick\Release/../USBHIDJoystick.cpp:22: undefined reference to `USB::USB()' D:\Dokumenty\Dev\USBHIDJoystick\Release/../USBHIDJoystick.cpp:23: undefined reference to `USBHub::USBHub(USB*)' D:\Dokumenty\Dev\USBHIDJoystick\Release/../USBHIDJoystick.cpp:24: undefined reference to `HIDUniversal::HIDUniversal(USB*)' ./USBHIDJoystick.o: In function `loop': D:\Dokumenty\Dev\USBHIDJoystick\Release/../USBHIDJoystick.cpp:44: undefined reference to `USB::Task()' ./USBHIDJoystick.o: In function `void ErrorMessage<unsigned char>(char const*, unsigned char)': D:\Dokumenty\Dev\USBHIDJoystick/message.h:30: undefined reference to `Notify(char const*)' D:\Dokumenty\Dev\USBHIDJoystick/message.h:31: undefined reference to `Notify(char const*)' D:\Dokumenty\Dev\USBHIDJoystick/message.h:33: undefined reference to `Notify(char const*)' ./USBHIDJoystick.o: In function `setup': D:\Dokumenty\Dev\USBHIDJoystick\Release/../USBHIDJoystick.cpp:38: undefined reference to `HIDUniversal::SetReportParser(unsigned char, HIDReportParser*)' make: *** [USBHIDJoystick.elf] Error 1
20:19:18 Build Finished (took 8s.739ms) hers the Eclipse Code
|
|
|
|
|
45
|
Using Arduino / Installation & Troubleshooting / Re: Arduino USB host Shild
|
on: July 06, 2012, 10:39:00 am
|
i just copy the folder and included it in arduino but im getting some errors C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:192: error: 'Off' has a previous declaration as 'Colors Off' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:84: error: multiple definition of 'enum Button' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:195: error: previous definition here C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:89: error: conflicting declaration 'SELECT' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:200: error: 'SELECT' has a previous declaration as 'Button SELECT' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:90: error: conflicting declaration 'L3' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:201: error: 'L3' has a previous declaration as 'Button L3' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:91: error: conflicting declaration 'R3' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:202: error: 'R3' has a previous declaration as 'Button R3' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:92: error: conflicting declaration 'START' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:203: error: 'START' has a previous declaration as 'Button START' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:93: error: conflicting declaration 'UP' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:204: error: 'UP' has a previous declaration as 'Button UP' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:94: error: conflicting declaration 'RIGHT' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:205: error: 'RIGHT' has a previous declaration as 'Button RIGHT' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:95: error: conflicting declaration 'DOWN' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:206: error: 'DOWN' has a previous declaration as 'Button DOWN' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:96: error: conflicting declaration 'LEFT' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:207: error: 'LEFT' has a previous declaration as 'Button LEFT' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:98: error: conflicting declaration 'L2' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:209: error: 'L2' has a previous declaration as 'Button L2' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:99: error: conflicting declaration 'R2' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:210: error: 'R2' has a previous declaration as 'Button R2' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:100: error: conflicting declaration 'L1' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:211: error: 'L1' has a previous declaration as 'Button L1' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:101: error: conflicting declaration 'R1' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:212: error: 'R1' has a previous declaration as 'Button R1' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:102: error: conflicting declaration 'TRIANGLE' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:213: error: 'TRIANGLE' has a previous declaration as 'Button TRIANGLE' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:103: error: conflicting declaration 'CIRCLE' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:214: error: 'CIRCLE' has a previous declaration as 'Button CIRCLE' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:104: error: conflicting declaration 'CROSS' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:215: error: 'CROSS' has a previous declaration as 'Button CROSS' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:105: error: conflicting declaration 'SQUARE' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:216: error: 'SQUARE' has a previous declaration as 'Button SQUARE' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:107: error: conflicting declaration 'PS' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:218: error: 'PS' has a previous declaration as 'Button PS' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:109: error: multiple definition of 'enum AnalogButton' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:240: error: previous definition here C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:112: error: conflicting declaration 'UP_ANALOG' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:243: error: 'UP_ANALOG' has a previous declaration as 'AnalogButton UP_ANALOG' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:113: error: conflicting declaration 'RIGHT_ANALOG' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:244: error: 'RIGHT_ANALOG' has a previous declaration as 'AnalogButton RIGHT_ANALOG' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:114: error: conflicting declaration 'DOWN_ANALOG' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:245: error: 'DOWN_ANALOG' has a previous declaration as 'AnalogButton DOWN_ANALOG' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:115: error: conflicting declaration 'LEFT_ANALOG' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3BT.h:246: error: 'LEFT_ANALOG' has a previous declaration as 'AnalogButton LEFT_ANALOG' C:\Users\THX\SkyDrive\Dokumenty\Atmel\Projects\AudrinoCore\Tools\arduino-1.0\libraries\USBHostShield/PS3USB.h:117: error: conflicting declaration 'L2_ANALOG'
do i need to import the full folder or only the lib that i need
|
|
|
|
|