When the battery is connected to the Solar Controller, it will charge as long as there is some sunlight. However, to get the most optimal charging conditions, you know that you want to aim your panel directly at the sun. You can do this by parking it so that it generally faces the Southern sky. Then, the programmable control methods with motors are used to move the panel to the optimal angle for capturing sunlight. The following is a sample of code that uses the remote control to provide manual movement input. If you want to go further with your design, how could you control the movement in a more "automatic" way?
Control Box Program
https://makecode.microbit.org/S96917-34365-02086-05411
This progam acts as the receiver or "listener" for instructions from the remote control. Each of the motor functions has been simplified by using functions. Logically, if the elevation “up” (north) motor is on, then the elevation “down” (south) should be off. You can’t move both up and down at the same time. This is also the case for the Azimuth (East vs. West) or “right” vs. “left”. A one output signal means ON and a zero means OFF. Pins 13, 14, 15, and 16 are wired to connect to the motor driver circuits. Other pins are available (i.e., P0, P1, P2 for further development.) Use this code or create your own to control the motors.
If all motors have zero output, then the movement stops.
Since the remote control is wireless, make sure to set your radio group number to a unique value that communicates with your (and only your) control box.
The control box waits for input from the remote control. When input data is received (as a number value), the corresponding function is called based on logical (if-then) conditions. The number value is also shown on the micro: bit LED matrix for debugging purposes.
Remote Control Program
https://makecode.microbit.org/60799-76821-95784-33897
Set your radio group number to a unique value that matches the control box code. The “set pull pin” values tell the micro:bit how to handle on or off signals. With this remote control, use NONE as the settings. Pins 13, 14, 15, and 16 on the remote control (game controller) correspond with the push buttons on the right side of the controller.
Example Logic for multiple types of remote control:
Since there is an analog joystick and digital push buttons, this code allows the user to toggle between using either one for control of the motors. “Buttons A and B” are the top buttons on the controller. Use this code or create your own to control the motors.
Push Buttons are simple on/off (digital) devices. The joystick is an analog device, so the programming is based on a range of values. Explore the code to learn more.