I am a totally new in code also totally new in use STM32F407 and now i doing the assignment for implementation of a state machine that will be driven by the joystick input.
The question including in the 1st picture i want to ask that is that any material allow me to learn for coding and solve assignment question.
2nd picture whole part of board
3rd picture is STM32F407
4th picture is the part of the joystick
This is my currency code :
#include "***-02.h"
uint8_t
GetJoystick ()
{
// REPLACE THE FOLLOW CODE WITH YOUR SOLUTION
// This code just to generate some input from the joystick
static uint8_t PreviousJoystick='L';
uint8_t Joystick;
Joystick = ReadJoystick ();
if (Joystick != 0)
{
PreviousJoystick = Joystick;
}
HAL_Delay(1000);
return PreviousJoystick;
}
void
StateMachine ()
{
// REPLACE THE FOLLOW CODE WITH YOUR SOLUTION
// This code just toggles top LED and set left or right LED.
//
// Solution.
uint8_t Joystick;
uint8_t Toggle = 0;
while (1)
{
Joystick = GetJoystick();
if (Joystick == 'L')
{
WriteLED ('L', LED_ON);
WriteLED ('R', LED_OFF);
}
else if (Joystick == 'R')
{
WriteLED ('L', LED_OFF);
WriteLED ('R', LED_ON);
}
if (Toggle == 0)
{
WriteLED ('T', LED_ON);
Toggle = 1;
}
else
{
WriteLED ('T', LED_OFF);
Toggle = 0;
}
}
}
Thanks for any help in advance!!!
