IT’S THE FINAL COUNTDOWN
This week we worked on refining our code and our model. Due to the issue of the stepper motor not stopping, and the absolute function not registering we’ve had to review our concept and make minor changes to work out how to work it.
Being the main thing that drives the motor, we started with the code. Instead of using a absolute function, we have edited the code to simplify the process of modulating the outcome of a formula. This can be shown below:
int light = _last – _current;
if (light < 0) light = light + light * 2;
What this code does is make sure that all of the differences between numbers are positive. This will link in to our other code, which checks if this number is larger than the threshold, which would then activate the stepper motor again. This part of the code can be found below:
if (_last == _current || light < threshold) isChanged = false;
We also learnt about tabs, how introducing tabs to the code can simplify the complexity of the code, and make sure everything is in its proper place without compromising the code itself. We have used tabs to separate the stepper motor’s code from the rest of the code to ensure no tangling is endured.
To view the code for this section click here.
FLOWCHART ON HOW IT WORKS
This shows the current set-up of our Ardunio board:
The model has been made out of card to ensure the motor is able to animate the flower. If wood were to be used it would been to much force for the stepper motor to move.
Each of the petals are connected to the pulley located on the motor. Each time the motor turns the string will become taught and animate the arms.
We created a container for the Ardunio to be placed in, also to support the motor. We also included a hole, so that we can control when the change in light takes place.
In order to ensure the readings from the light sensor was accurate, we changed the light sensor to be more advanced. This light sensor already had a resistor built into it, so removed the clutter found on the breadboard further.
A video of the working model can be viewed here.
WHAT DIDN’T WE DO?
Unfortunately due to the time constraints we were not able to fulfil all of our desired requirements. We were not able to install the speaker, which was due to the long amount of time that was spent on trying to fix the code. I feel that if we were to take this forward we would focus more on the form of the model, making it look more like a rose.