Sunteți pe pagina 1din 5

3.

0 PROGRAMMING FLOWCHART

uint8_t RemoteXY_CONF

255,3,0,0,0,29,0,8,13,0,

5,7,41,17,30,30,1,26,31,2,

0,10,6,22,11,134,204,31,31,79
,

78,0,79,70,70,0
struct

int8_t joystick_1_x

int8_t joystick_1_y

uint8_t switch_1

uint8_t connect_flag

RemoteXY

unsigned char first_motor[3]=

IN1, IN2, ENA

unsigned char second_motor[3]=


IN3, IN4, ENB

void Speed (unsigned char pointer, int


motor_speed)

motor_speed>100

True Fale
motor_speed=100

motor_speed<-100
True
motor_speed=-100 False

motor_speed>0

True
False
digitalWrite(pointer[0],
HIGH)

motor_speed<0

digitalWrite(pointer[1],
LOW)

analogWrite(pointer[2],
motor_speed2.55)
digitalWrite(pointer[0], digitalWrite(pointer[0],
LOW) LOW)

digitalWrite(pointer[1], digitalWrite(pointer[1],
HIGH) LOW)

analogWrite(pointer[2], analogWrite(pointer[2],
(-motor_speed)2.55) 0)

void setup()

RemoteXY_Init ()

pinMode (PIN_SWITCH_1, OUTPUT)

pinMode (IN1, OUTPUT)

pinMode (IN2, OUTPUT)

pinMode (IN3, OUTPUT)


pinMode (IN4, OUTPUT)

pinMode (ledpin13, OUTPUT)

pinMode (ledpin4, OUTPUT)

pinMode (ledpin5, OUTPUT)

pinMode (ledpin6, OUTPUT)

RemoteXY_Init ()

void loop()

RemoteXY_Handler ()

digitalWrite(PIN_SWITCH_1,
(RemoteXY.switch_1==0)?LOW:HIGH)

RemoteXY_Handler ()
digitalWrite (ledpin13,
(RemoteXY.switch_1==0)?LOW:HIGH)

digitalWrite (ledpin4,
(RemoteXY.switch_1==0)?LOW:HIGH)

digitalWrite (ledpin5,
(RemoteXY.switch_1==0)?LOW:HIGH)

digitalWrite (ledpin6,
(RemoteXY.switch_1==0)?LOW:HIGH)

Speed (first_motor, RemoteXY.joystick_1_y -


RemoteXY.joystick_1_x)

Speed (second_motor, RemoteXY.joystick_1_y +


RemoteXY.joystick_1_x)

S-ar putea să vă placă și