11520 war ein Tippfeheler.
Python Code:
import serial #Serial imported
import time #import delay functions
STM = serial.Serial('com33',115200)
time.sleep(0.5)
STM.write('0') #send 0
generated Code:
void Python_22_step(void)
32 {
33 /* UARTRx: '<Root>/UART Rx' */
34 UARTRx_Receive(&UART2_Temp_Buffer[0], 1);/* Blocking */
35 memcpy(&Python_22_B.UARTRx, &UART2_Temp_Buffer[0],
1*sizeof(uint8_T));/* D0 [1] */
36
37 /* RelationalOperator: '<S1>/Compare' incorporates:
38 * Constant: '<S1>/Constant'
39 */
40 Python_22_B.Compare = (Python_22_B.UARTRx > 0);
41
42 /* S-Function (stm32f4_digital_output): '<Root>/Digital Output' */
43
44 /* DigitalOutput */
45 {
46 *DigitalOutput_A5 = Python_22_B.Compare;
47 }
48 }
49
50 /* Model initialize function */
51 void Python_22_initialize(void)
52 {
53 /* Registration code */
54
55 /* initialize error status */
56 rtmSetErrorStatus(Python_22_M, (NULL));
57
58 /* block I/O */
59 (void) memset(((void *) &Python_22_B), 0,
60 sizeof(B_Python_22_T));
61
62 /* Level2 S-Function Block: '<Root>/UART Rx' (stm32f4_usart) */
63 enable_UARTRx();
64
65 /* Level2 S-Function Block: '<Root>/Digital Output'
(stm32f4_digital_output) */
66 enable_DigitalOutput();
67
68 /* Level2 S-Function Block: '<Root>/UART Setup' (stm32f4_usart) */
69 enable_UARTSetup();
70 }
71
72 /* Model terminate function */
73 void Python_22_terminate(void)
74 {
75 /* Terminate for S-Function (stm32f4_digital_output):
'<Root>/Digital Output' */
76
77 /* terminate_DigitalOutput(); */
78 }
79
80 /* [EOF] */