Controlling a movement of the cart using a motor
hello,
i new using arduino. project build cart moved motor controlled inverter. program control inputs inverter , receiving feedback potentiometer , end switches. acording program selection move in different direction. problem have controlling function "miscarestdrststop" (the cart moving left right stop , after right left , stop; program ends) , function "miscarestdrcontinua" ( cart moving continuous left right untill stop off push button activated).
the cart after executing movement left right not moving right left. stays there.
if can me this, apreciated. thanks.
i new using arduino. project build cart moved motor controlled inverter. program control inputs inverter , receiving feedback potentiometer , end switches. acording program selection move in different direction. problem have controlling function "miscarestdrststop" (the cart moving left right stop , after right left , stop; program ends) , function "miscarestdrcontinua" ( cart moving continuous left right untill stop off push button activated).
the cart after executing movement left right not moving right left. stays there.
if can me this, apreciated. thanks.
first part of program :
code: [select]
/*
* program controlling cart movement
*/
int switchparcare = 3; // switch parking connected pin 3
int switchcapstanga = 4; // switch left connected pin 4
int switchcapdreapta = 5; // switch right connected pin 5
int progrp1 = 6; // selection program p1 parking position connected pin 6
int progrp2 = 7; // selection program p2 midlle fixed position connected pin 7
int progrp3 = 8; // selection program p3 left right , stop connected pin 8
int progrp4 = 9; // selection program p4 left right, right left , stop connected pin 9
int progrp5 = 10; // selection program p5 continuous movement left right , reverse connected pin 10
int progrp6 = 19; // selection program p6 departure position connected pin 19
int switchpornit = 11; // switch start of movement connected pin 11
int switchoprit = 12; // switch stop of movement connected pin 12
// commands electromagnetic brake of motor , inverter controls motor direction, speed , on/off
int comandafrana = 13; // command electromagnetic brake connected pin 13
int comandapoinv = 15; // command on/off motor connected pin 15
int comandasens = 16; // command direction of motor connected pin 16
int comandaselv1 = 17; // command speed selection v1 connected pin 17
int comandaselv2 = 18; // command speed selection v2 connected pin 18
int potmotor = 0; // potentiometer position of cart controlled motor analog pin 0
int valp1; // variable storing value of selection program p1 (parking)
int valp2; // variable storing value of selection program p2 (fixed position midlle)
int valp3; // variable storing value of selection program p3 (movement left right , stop)
int valp4; // variable storing value of selection program p4 (movement left right, right left , stop)
int valp5; // variable storing value of selection program p5 (continuous movement)
int valp6; // variable storing value of selection program p6 (start position)
int swparc; // variable storing value of parking switch
int swcapst; // variable storing value of left switch
int swcapdr; // variable storing value of right switch
int potmotvalue; // variable storing value of potentiometer connected cart
int valp1po1; // variable storing value 1 of on push-button program p1
int valp1po2; // variable storing value 2 of on push-button program p1
int valp1op1; // variable storing value 1 of off push-button program p1
int valp1op2; // variable storing value 2 of off push-button program p1
int p1mode = 0; // state of push-button program p1
int valp2po1; // variable storing value 1 of on push-button program p2
int valp2po2; // variable storing value 2 of on push-button program p2
int valp2op1; // variable storing value 1 of off push-button program p2
int valp2op2; // variable storing value 2 of off push-button program p2
int p2mode = 0; // state of push-button program p2
int valp3po1; //
int valp3po2; //
int valp3op1; // same previous
int valp3op2; //
int p3mode = 0; //
int valp4po1; //
int valp4po2; //
int valp4op1; // same previous
int valp4op2; //
int p4mode = 0; //
int valp5po1; //
int valp5po2; //
int valp5op1; // same previous
int valp5op2; //
int p5mode = 0; //
int valp6po1; //
int valp6po2; //
int valp6op1; // same previous
int valp6op2; //
int p6mode = 0; //
int x; // global variable controlling function left right , stop , function right left , stop
void setup() {
pinmode(switchparcare, input); // setting input parking switch
pinmode(switchcapstanga, input); // setting input left switch
pinmode(switchcapdreapta, input); // setting input right switch
pinmode(progrp1, input); // setting input program p1
pinmode(progrp2, input); // setting input program p2
pinmode(progrp3, input); // setting input program p3
pinmode(progrp4, input); // setting input program p4
pinmode(progrp5, input); // setting input program p5
pinmode(progrp6, input); // setting input program p6
pinmode(switchpornit, input); // setting input push-button on
pinmode(switchoprit, input); // setting input push-button off
pinmode(comandafrana, output); // setting output command of electromagnetic brake
pinmode(comandapoinv, output); // setting output command on/off motor
pinmode(comandasens, output); // setting output command direction of motor
pinmode(comandaselv1, output); // setting output command speed selection v1 of motor
pinmode(comandaselv2, output); // setting output command speed selection v2 of motor
serial.begin(9600); // set serial communication @ 9600bps
}
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Controlling a movement of the cart using a motor
arduino
Comments
Post a Comment