#include "libschsat.h" void control(void) { char answer[255]; // Create an array to hold the response int32_t count = 5; // Set the counter for 5 steps /* * Transfer a command for receiving the response with ID 2 to Arduino using the arduino_send built-in function * The first argument is the Arduino ID (defaults to 0) * The second argument is message ID (2 in our case) * The third argument is the data being transferred (NULL as we don’t have any data to send) * The fourth argument is the buffer to receive data (in our case it is the array named answer for incoming data) * The fifth argument is the time, in milliseconds, to wait for a response from Arduino (100 ms in our case). */ while (count > 0){ int status = arduino_send(0, 2, NULL, answer, 100); if (status == 0){ printf("Answer: %s\r\n", answer); } else{ printf("Error\r\n"); } mSleep(500); count--; } }