MECH532 Design of Mechatronics Systems
Answered
Task:
Need for the lab report : (400 words total) 1) objectives ( 100 words) 2) introduction (150 words) 3) conclusion (150 words) please answer all of the lab report requirements questions in CW7 I have already done the procedure and discussion parts
In this lab we were required to adjust DC motor speed with potentiometer input.
1.Open the program and apply the connection below
2.Run the simulation and play with knob of the potentiometer in order to change the current and voltage.
3.The code is the following
Explanation of the code
Firstly, we have defined the variables, our input is the potentiometer (A0). In the void loop we have used analog Read in order to read the input voltage.
We have used the map function in order to change the range from low analog (0 ) , the high (1023) and to low digital (0 ) to high (255). Then our output is the transistor which is connected to 3 digital pin.
In this classwork we were required to adjust the motor speed and direction of it using potentiometer and H-bridge Motor drive.
1.Open the program and do the circuit.
2.Run the simulation and code
3.Explanation of code
Firstly, we have defined variables as integers as the exercise above. In the void setup, we have set 3 outputs.
We have used the serial begin function in order to run the program in bits per second.
As discussed in the previous labs. In the void loop, we have an if condition which states that if the value of potentiometer is more than 127, then we set the pin 12 as high and pin 11 as low. Additionally, we have used the map function in order to change the range from 127 to 255.
If the condition is lower than 127 then the program must set pin 11 as high and pin 12 as low.