Show Posts
Pages: 1 ... 53 54 [55] 56 57 ... 262
811  Using Arduino / Motors, Mechanics, and Power / Re: Servo toggle 180 on press and rotate back again on press on: February 04, 2014, 04:21:20 am
I haven't time to look properly, but there's a numbering discrepancy in what you're doing with the input pin...

You set button1 as input, and button1 is pin 4. But then you make pin7 high: I suspect those should both be either 4 or 7.

That might be part of your problem, seeing as you are hoping for active low I think, which does require the pullup, which with your current code won't be right.

Newer way of doing pullups is not to set a pin as input in one line, and high in another. This way is simpler:

Code:
pinMode(7, INPUT_PULLUP);
812  Development / Suggestions for the Arduino Project / Re: Serial Monitor closes automatically when downloading. on: February 04, 2014, 03:57:41 am
Read Reply#5 on this thread
813  Development / Suggestions for the Arduino Project / Re: Serial Monitor closes automatically when downloading. on: February 04, 2014, 03:10:16 am
I don't think you miss the first output, because my understanding is that when you open the monitor it resets the board so your sketch starts again anyway.

That might in itself be a problem of another sort though.... 
814  Using Arduino / General Electronics / Re: Help with electronic components on breadboards on: February 04, 2014, 01:39:49 am
FYI, those little pushbutton switches (and a lot of trimmers too) have those funny legs because they're designed to spring into place on a printed circuit board and hold themselves in during soldering. Here's one with "unfunny" legs that would work in a breadboard: http://www.dipmicro.com/store/SWITCH8X8B

Is the pic below the "funny legs"? Always wondered why they're shaped like that!
815  Development / Suggestions for the Arduino Project / Re: Serial Monitor closes automatically when downloading. on: February 03, 2014, 10:19:42 pm
Quote
I would like to have it open all the time so that the loading of a program and running it is faster

Wow- how often are you uploading new code that it makes it so important?
816  Using Arduino / Motors, Mechanics, and Power / Re: I need help to control 2 dc motors with a ps2 analog joystick on: February 03, 2014, 09:51:05 pm
To do the speed thing on another motor, just double up the code and adjust the pins and variables.

Something like this: untested, ymmv

Code:
int joy1 = 0;
int motor = 3;
int joy2 = 1;
int motor2 = 5;   //  pin 4 isn't pwm so use 5

void setup(){
 
pinMode(motor,OUTPUT);
pinMode(joy1,INPUT);

pinMode(motor2,OUTPUT);
pinMode(joy2,INPUT);
}

void loop(){
  int ppp;
int ppp2;
  ppp = analogRead(joy1); 
  ppp = map(ppp, 0, 1023, -255, 255);     
  analogWrite(motor,ppp);

 ppp2 = analogRead(joy2); 
  ppp2 = map(ppp2, 0, 1023, -255, 255);     
  analogWrite(motor,ppp2);
}

For direction, you will need to give details about the connections to the motor. Direction control needs an h-bridge to reverse the polarity on the motor.  Can you post a circuit diagram?

817  Using Arduino / Programming Questions / Re: Discover Arduino on: February 03, 2014, 09:31:51 pm
Quote
Ok JimboZA, I will. I can't do it now because I don't have the materials to make it but it will be efficient to found the bug with this function.

You don't need any materials to do what I suggested: Serial output is to the IDE monitor (contril-shift-M) through the usb cable.
818  Using Arduino / Programming Questions / Re: Using hardware switch to allow switching between programmed tasks? on: February 03, 2014, 11:10:33 am
You could test your concept without the SD card, and a piece of wire for a switch.

Set a pin to be an input with pullup enabled, then the input will be high. Make it go low by having a wire in GND and put the other end in your chosen pin. Then your pseudo code simply becomes:

Code:
If pin is high
{
maybe switch on led 13
serial print a note to say "hi"
}
else
{
switch off led 13
serial print a note to say "lo"
}
819  Using Arduino / Displays / Re: Ardino At Heart Certified arLCD on: February 03, 2014, 10:30:10 am
Ok so according to Sparkfun it's a touch screen integrated with an Uno. But the page goes on to say it's Uno compatible.... how does that gel with it saying the Uno is built-in?

Does the built-in Uno just drive the screen and you still need another one for the rest of the project?... or what...
820  Using Arduino / Project Guidance / Re: 3D Printer as my final year project on: February 03, 2014, 10:24:03 am
I agree with wildbill there, and is kind of what I had in mind with the robot arm. Easy to get it doing something simple- perhaps responding to joysticks (that's totally trivial in fact, the code for that is basically servo knob, doubled up for two axes) but another thing altogether to get it to pick-and -place parts, perhaps sensing their size or colour or words on the label and putting them in the right boxes.

In fact, it's what I have in mind for the uArm I'm assembling. when my daughter's at uni next year, she'll have a solid mechanical platform to expand from- different end-effectors and sensors measuring an ever more complex environment and responding to it.

821  Using Arduino / Project Guidance / Re: 3D Printer as my final year project on: February 03, 2014, 09:57:54 am
I am very interested in embedded software development

So make that the focus-- not the mechanical stuff which will be great fun and a huge learning experience, but is unlikely to be a large part of the marks in a computer engineering course.

Embedded control is all about the sensors and code to drive the actuators- so make the mechanical part as simple as you can, within the limits of what they expect- and concentrate on the embedded software and associated electronics to drive the thing.
822  Using Arduino / Project Guidance / Re: 3D Printer as my final year project on: February 03, 2014, 07:17:10 am
please note that it is a school project and so you need to do things yourself rather than just buying them.

.... whatever that means. You have to buy stuff.... if you couldn't, then you wouldn't be talking about using an Arduino as your computing / electronics platform, you would be asking how to make discrete components from beach sand.

Since it's computer engineering, and includes an element of electronics, are they expecting you to build the mechanics from scratch too? That would be absurd, and I doubt if that's their intent.

So I'd assume you can get away with a store-bought or at most assemble it yourself mechanical platform if your project requires  such a thing.  There are a zillion things you can implement with a ready-made mechanical platform, while staying inside the spirit of the learning intent.

Mate of mine did his PhD many years ago in mathematically modeling the human knee in a sports context. Yet another pal designed and built the mechanical test rig for that work. There was no problem there, since the PhD wasn't in mechanical engineering, it was in medical physics or some crap. 

My advice is simplify the mechanical side- you already said you're worried about time- so that you can concentrate on the actual topic: the systems engineering, the coding and the electronics.
823  Using Arduino / Displays / Re: Ardino At Heart Certified arLCD on: February 03, 2014, 06:59:48 am
My question has to be simply "What is it?"
824  Using Arduino / Project Guidance / Re: 3D Printer as my final year project on: February 03, 2014, 06:20:28 am
I agreed with Paul: If you want to have a machine of some variety, I  would be more inclined to go for a simple mechanical build, and then go to town on the computing side of it.

The uArm, for example, is dead simple to build, but then you could fit any kind of end-effector that takes your fancy and engineer it to do whatever. Inverse kinematics is no trivial task, for instance, and you might be able to improve on some current algorithms.

You can satisfy the need for electronics with some cunning sensors, perhaps some kind of fail-safe thing to ensure the end-effector never leaves the allowed "cube" even if the program tries to force it out.
825  Using Arduino / Programming Questions / Re: Discover Arduino on: February 03, 2014, 05:41:50 am
How do you know the outputs aren't correct?

I'd suggest you use Serial to debug, perhaps printing the values as it reads them, and then printing a message to say which part of the if it is in. See my <<<<<<< comments below.

Code:
#define P_PV A0
#define P_R A1
#define P_C A2
#define K_PV 2
#define K_R 3

int PV, C;

void setup()
{               
  pinMode(P_PV, INPUT);
  pinMode(P_R, INPUT);
  pinMode(P_C, INPUT); 
  pinMode(K_PV, OUTPUT);     
  pinMode(K_R, OUTPUT);
 
  digitalWrite(K_R, LOW);
  digitalWrite(K_PV, LOW); 

Serial.begin(9600); //<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Serial.println("Starting...."); //<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}


void loop()
{
    PV=analogRead(P_PV);
Serial.println(PV); //<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    C=analogRead(P_C);
Serial.println(C); //<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
    if(PV>C)
    {
Serial.println("In the PV > C part of the if"); //<<<<<<<<<<<<<<<<<<<<<<<<<<<<
      digitalWrite(K_R, HIGH);
      digitalWrite(K_PV, LOW);
    }
   
    else
    {
Serial.println("In the else part"); //<<<<<<<<<<<<<<<<<<<<<<<<<<<<
      digitalWrite(K_R, LOW);
      digitalWrite(K_PV, LOW);
    }
}
Pages: 1 ... 53 54 [55] 56 57 ... 262