A 3D-printed flower consisting of 2 servo motors and 4 light-dependent resistors (LDR). When running keyboard.cpp, in "automatic" mode, motors rotate to face the flower towards light. In "manual" mode, keyboard input is used to rotate the flowers. Running joystick.py allows for manual mode with an Xbox controller controlling rotation.
This is the solution to MECHTRON 2TA4 term project, requiring a cybernetic finite state machine. This machine responds to inputs coming from either the environment itself (light sources) or users within the environment (keyboard input and controller input). Using an ARM Cortex-M4 microcontroller, the specified equipment (LDRs and actuators), and the references cpp and python files, the face of the 3D-printed flower will react based on said inputs and adjust it's position.
Connect microcontroller to your device and run the program. Flower will start in automatic mode, and will point towards the nearest light source. Moving the light source (i.e. moving your phone flashlight) will result in the motors rotating to turn the flower towards the light, based on the resistance values and comparision of perpendicular resistors. Hitting "m" on your keyboard will switch to manual mode, and allow for rotation of the flower using "w", "a", "s", and "d" keys. Clicking "m" will switch back to automatic mode.
Have keybaord.cpp running on your IDE, and connect microcontroller to your device. Close IDE and run joystick.py out of terminal. Connect the Xbox controller to your device. The flower will start in automatic mode. Hit "m" on your keyboard for manual mode, and rotate the flower using the left joystick on the controller. Hitting "m" again will switch back to automatic mode.