cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Cl.1
Associate II

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.
_legacyfs_online_stmicro_images_0693W000000VCg6.png2nd picture whole part of board
_legacyfs_online_stmicro_images_0693W000000VClB.png3rd picture is STM32F407
_legacyfs_online_stmicro_images_0693W000000VCkw.png4th picture is the part of the joystick
_legacyfs_online_stmicro_images_0693W000000VCkh.png

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!!!

10 REPLIES 10
Cl.1
Associate II

Hi clive, u are miss understanding me i not request u to help me do the assignment. I will do every thing by myself i just need some reference from some book or some forum.

I trying to read the K&R C manual that u suggested.

Thanks for taking time to reply me.