Electric Tiger DAQ  1.0.0
Data Acquisition Software for the Electric Tiger Experiment
test_stepper_motor.h
1 #ifndef TEST_STEPPER_MOTOR_H
2 #define TEST_STEPPER_MOTOR_H
3 
4 //C System-Headers
5 //
6 //C++ System headers
7 #include <memory>
8 //Boost Headers
9 //
10 //Qt Headers
11 //
12 //Project specific headers
13 #include "stepper_motor.h"
14 #include "../Arduino/arduino.h"
15 #include "../../Generics/generics.h"
16 
17 void TestStepperMotor() {
18 
19  std::cout << "Testing Stepper Motor." << std::endl;
20 
21  const TCPSocketParam stepper = TCPSocketParam( "Stepper", "10.95.100.177", 7776 );
22  std::shared_ptr<StepperMotor> stm23_ee = std::shared_ptr<StepperMotor>( new StepperMotor( stepper.ip_addr,\
23  stepper.port_addr ) );
24 
25  std::cout << "Tuning cavity by + 1 inch." << std::endl;
26  stm23_ee->TuneCavity( 1.0 );
27 
28  sleep(5);
29 
30  std::cout << "Tuning cavity by - 1 inch." << std::endl;
31  stm23_ee->TuneCavity( -1.0 );
32 
33 }
34 
35 void TestStepperMotorWithArduino() {
36 
37  std::cout << "Testing Stepper Motor and Arduino." << std::endl;
38 
39  const TCPSocketParam arduino_info = TCPSocketParam( "Arduino", ";10.66.192.41", 23 );
40  std::shared_ptr<Arduino> arduino = std::shared_ptr<Arduino>( new Arduino( arduino_info.ip_addr,\
41  arduino_info.port_addr ) );
42 
43  const TCPSocketParam stepper = TCPSocketParam( "Stepper", "10.95.100.177", 7776 );
44  std::shared_ptr<StepperMotor> stm23_ee = std::shared_ptr<StepperMotor>( new StepperMotor( stepper.ip_addr,\
45  stepper.port_addr ) );
46 
47  const double starting_length = 6.0;
48  double cavity_length = arduino->GetCavityLength();
49 
50  std::cout << "Setting cavity to length of " << starting_length << " Inches." << std::endl;
51  stm23_ee->TuneToLength( starting_length, cavity_length );
52 
53 }
54 
55 #endif // TEST_STEPPER_MOTOR_H
Object to send and receive commands from an Arduino Uno (R3)
Definition: arduino.h:21
Definition: configprocessor.h:38
Object to sends commands to an Applied Motion products stepper motor.
Definition: stepper_motor.h:19